Question

My program knows in advance that it will access certain (many/large) files or directories in the future. Is there an intended mechanism to pass this information on to Windows so it can load these into a buffer? Or do I have to open the files myself in a background thread?

Was it helpful?

Solution

That is the "everybody would use it if they could" function. Similar to the WS_EX_SUPER_TOPMOST window style flag and the NIF_NEXT_TO_THE_CLOCK options for the NOTIFYICONDATA.uFlags option value. Not available either.

It's not like you couldn't cheat the system, big companies are not ashamed about it. Looking at you Adobe. You have free reign of the machine once you coax a user to run your installer. So you can install a program that runs at login and doesn't do anything but load all the DLLs that your program needs. You call it "optimizer" to make the user feel good about it. Even though Prefetch is fooled by it, it is also rather important that you publish monthly Critical Security Updates so you can put it back when the user removed it.

The word "coax" is the operative one though, most users stopped trusting their machines 15 years ago. Well, no, they stopped trusting programmers. That will never come back, big shame.


If this is actually needed for a file that you don't need at startup like an implicitly loaded DLL or a data file you need to read to make your program useful, and can foresee the need for a file some time in the future, then the linked duplicate is a solution.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top