Notepad2e
Notepad2e copied to clipboard
Show program's name in "File is busy" dialog
When you delete or move a file that's opened in a program, sometimes Explorer displays the name of the locking program in the error dialog. Research if we can make Notepad 2e do the same.
Standard IFileIsInUse interface has required functionality.
Let's implement it, disabling for XP so that Notepad 2e still works in that OS.
- OF_CAP_CANSWITCHTO
- OF_CAP_CANCLOSE - CloseFile works like WM_CLOSE on Notepad 2e's window, bringing Save prompt if necessary
- FUT_EDITING - GetUsage
Please consider the following:
IFileIsInUseinterface can be used to provide/retrieve details by exclusively locked file.- Explorer use it to retrieve the file owner and to display "File In Use" dialog with appropriate options.

IFileIsInUseinterface is not always implemented by applications. This cause Explorer to only sometimes display the name of the locking program.
Do we need to make Notepad2e itself provide details on his locked file (looks useless since it almost never use exclusive file lock) or do we want to implement the same "File In Use" prompt as used in Explorer? Please provide your scenario with details on how Notepad2e is expected to work.
Do we need to make Notepad2e itself provide details on his locked file (looks useless since it almost never use exclusive file lock)
I don't want to add exclusive locking, of course. My idea is that Notepad2 locks the directory of the file, not the file itself, and Explorer shows the same "File In Use" dialog but without program name. Is it possible to supply Notepad 2e info in that dialog without actually locking the file?
or do we want to implement the same "File In Use" prompt as used in Explorer?
What do you mean here?
Do we need to make Notepad2e itself provide details on his locked file (looks useless since it almost never use exclusive file lock)
I don't want to add exclusive locking, of course. My idea is that Notepad2 locks the directly of the file, not the file itself, and Explorer shows the same "File In Use" dialog but without program name. Is it possible to supply Notepad 2e info in that dialog without actually locking the file?
Regarding the documentation this interface is utilized to retrieve file owner information in case of file access issues:
When an application attempts to access a file and finds that file already in use, it can use the methods of this interface to gather information to present to the user in a dialog box.
Thus, it looks like file should be forcedly locked.
or do we want to implement the same "File In Use" prompt as used in Explorer?
What do you mean here?
Which of the application (Notepad2e or Explorer) is expected to show program's name in "File is busy" dialog? There are 2 different cases:
- Notepad2e provide details, Explorer show "File is busy" dialog.
- Notepad2e retrieve details from foreign applications and display "File is busy" dialog when having file access issues.
Regarding the documentation this interface is utilized to retrieve file owner information in case of file access issues:
I had a typo, not sure if it was clear enough. My use case is: open any document in Notepad2, open that file in Explorer, delete that file - it is deleted fine. Next try to delete the parent directory of the file - Explorer will throw up the Folder In Use dialog. Therefore the original question (even though this issue is titled "File is busy") was if it's possible to show the program's name in that dialog or not.
That said, why Notepad2/e lock the directory at all? I would understand if the file was opened via the open file dialog (Ctrl+O) - that dialog is known to chdir into the folder. However, if you drag & drop the file into Notepad2 the directory would be locked anyway, and would remain this way unless Notepad2 opens a file from another folder. It isn't unlocked even if you close the file (Ctrl+N).