> How can I get the Windows directory path in a STRING format?

Quoting others more learned than myself ...

For Windows 9x the source will be

var
  WindyPath : String;
uses
  Registry;
...
  with TRegistry.Create do
  try
    RootKey := HKEY_LOCAL_MACHINE;
    if OpenKey('SOFTWARE\Microsoft\Windows\CurrentVersion',
                         False) then
      WindyPath := ReadString('SystemRoot');
    CloseKey;
  finally
    Free;
  end;

For Windows NT the path should be a bit different:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\
Windows NT\CurrentVersion.

You can easily check what Windows (9x or NT) you
currently use if you check whether the key

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT

exists.


or ... you could try the API function GetWindowsDirectory.

HTH,
Craig.


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to