[quote user="David Harris"][quote user="vefatica"]
There's a folder, "Summer07", on my desktop (files for a course I'm teaching). I wanted to rename the folder. Windows XP wouldn't let me because an application was using the folder. Investigation showed Pegasus Mail had 4 open handles to that folder.
[/quote]
There are two separate and distinct problems here. The first is Windows itself: when you call GetOpenFileName, a side-effect of selecting a file is to change the current working directory to the one containing the selected file. As long as any application has a directory selected as its working directory, no other application can rename or delete that directory. It's probably possible to work around this problem (I've made a note to check it out).
The other problem is more complicated. The Borland runtime libraries (from the ageing compiler used to compile v4.41) create a handle to a directory when I do a directory contents scan, and cannot be told to release that handle. The problem is to do with the legacy "findfirst" and "findnext" routines, which date from DOS times and which don't have a matching "endfind" command to terminate the scan. As a result, the RTL has to do some calisthenics - essentially, it tries to "guess" when the directory handle is no longer required and doesn't release it until then. It's most unsatisfactory, and has other side-effects as well. It's also totally outside my control in that version of the code.
As part of the move to Visual C, I had to rework these routines from scratch, so this problem no longer occurs in the current builds of the program. This means you can expect it to be fixed in the next update.
[/quote]
Thanks for the in-depth reply. I didn't know GetOpenFileName() did that (it's not very nice). I've used GOFN() but was never bitten by it. And I had wondered about the status of the move to VC.
- Vince