Prompting for Files

You can automatically prompt the user to insert the correct disk before reopening a file by using the OF_PROMPT option. OpenFile uses the filename to create a prompt string. If you are reopening a file, you need to use the OF_REOPEN and OF_PROMPT options in addition to specifying how you want to open the file:

hFile = OpenFile((LPSTR)NULL, &OfStruct, OF_PROMPT | OF_REOPEN

| OF_READ);

If you reopen a file as read only, Windows will check whether the date and time match the date and time of the file when it was first opened.