View Single Post
Old 4th September 2007, 19:38   #11
ChesterBr
Junior Member
 
Join Date: Sep 2007
Posts: 2
Just to clarify, Notepad does not keep a file open. What it does when you open a file is:

a) Open the file
b) Read all of its contents in memory (swap file will implicitly be used here if file is too big)
c) Close the file, only remembering its local name

When you are editing the "file" (i.e., the in-memory data), the file can be freely deleted, moved, etc.

If you save the file, it reopens the file, writes back all data and closes it. If the file is not there anymore, the save becomes a "save as", prompting you for a new file name.

So Notepad is not a great tool to check if a file is open. Word (or OpenOffice Write), however, will do the trick, since they keep the file open while editing (even text files).

Anyway, does anyone has any example checking if a program is open? I would like my uninstaller to make sure the program is closed (or even close it) before uninstalling, otherwise, the program (and its companion DLLs) are not uninstalled.

Thanks!
ChesterBr is offline   Reply With Quote