Board index » delphi » ChDir under Windows NT 3.51

ChDir under Windows NT 3.51

I've got an application which works fine under Win 3.1, Win 95, and
mostly WinNT.  One part just started failing...

Before I open the Windows file open dialog, I use GetDir to find out
what the current directory is.  Then I run the dialog, get my file, and
call ChDir (or SetCurDir) to get back to the original directory.  (The
dialog changes the current directory)

Under NT, the call to ChDir fails.  Runtime error 15... invalid drive
number.  this is posing some serious headaches...  
It only fails when changing between drives.  It works properly on
directories on the same drive.

Anyone know another way of changing drives under windows / Windows NT.

I'm stuck in BP7 as Borland chose not to move OWL forward....

Any help/suggestions will be greatly appreciated.

-Pete
P...@PdProg.Com

 

Re:ChDir under Windows NT 3.51


Quote
Pete d'Oronzio wrote:
> Before I open the Windows file open dialog, I use GetDir to find out
> what the current directory is.  Then I run the dialog, get my file, and
> call ChDir (or SetCurDir) to get back to the original directory.  (The
> dialog changes the current directory)

> Under NT, the call to ChDir fails.  Runtime error 15... invalid drive
> number.  this is posing some serious headaches...
> It only fails when changing between drives.  It works properly on
> directories on the same drive.

Well, I found a fix, if not the reason for the problem.

The problem only occurs when a call to the Windows CommonDlg File Open Dialog is
made between the first GetDir and the restoring ChDir.  

Calling GetDir inbetween GetLoadFile, and before ChDir makes everything work fine.
It just means having a variable called NTDummy to store the returned path in.

If anyone knows WHY this is happening, I'd love to know.

-Pete
P...@PdProg.Com

Other Threads