Board index » delphi » default directory of Windows NT or Windows 98

default directory of Windows NT or Windows 98

Hello,

   I would like to ask the system for the current default directory of
either Windows NT or Windows 98.  I would like to use FileExists using
windows default path or variable. Any suggestions?    Ex. "c:\winnt\" or
"c:\windows"

Thanks in advance,

Dave

 

Re:default directory of Windows NT or Windows 98


"David C Sherman" <David.Sher...@po.state.ct.us> wrote in message
news:8a2v9b$4d88@bornews.borland.com...

Quote
>    I would like to ask the system for the current default directory of
> either Windows NT or Windows 98.  I would like to use FileExists using
> windows default path or variable. Any suggestions?    Ex. "c:\winnt\" or
> "c:\windows"

Try this:

VAR
  Path: STRING;
  PathLength: DWORD;
...
PathLength := GetWindowsDirectory(NIL,0);
SetLength(Path, PathLength);
GetWindowsDirectory(pChar(Path), PathLength);
SetLength(Path, PathLength-1); // get rid of null terminator
ShowMessage(Path)

Other Threads