Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 12-24-2005, 08:36 PM
fmmash fmmash is offline
Junior Member
 
Join Date: Dec 2005
Posts: 3
Default windir

i need windows directory in windows xp
please help me
thanks
Reply With Quote
  #2  
Old 12-25-2005, 12:20 AM
douglas douglas is offline
Senior Member
 
Join Date: Jul 2001
Posts: 7,695
Default RE: windir

function GetWinDir : string;
var
buf : array[0..MAX_PATH] of char;
pc : Pchar;
begin
pc := @buf[0];
GetWindowsDirectory(pc, MAX_PATH);
Result := StrPas(pc);
end;


procedure TForm1.FormCreate(Sender: TObject);
begin
ShowMessage(GetWinDir);
end;

If this helps, please accept as answer!

Thanks!

UnS

ysApps
Reply With Quote
  #3  
Old 12-25-2005, 03:03 PM
gLes gLes is offline
Senior Member
 
Join Date: Jan 2001
Posts: 2,273
Default RE: windir

Here is an alternate version:

[delphi]function GetWindir: String;
var
Buffer: array[0..MAX_PATH] of Char;
begin
ExpandEnvironmentStrings('%systemroot%', @Buffer, MAX_PATH);
Result := String(Buffer);
end;[/delphi]

Hope that helps...

gLes
Reply With Quote
  #4  
Old 12-30-2005, 04:21 AM
douglas douglas is offline
Senior Member
 
Join Date: Jul 2001
Posts: 7,695
Default RE: windir

Has this question been answered, or do you still need more help?

If this helps, please accept as answer!

Thanks!

UnS

ysApps
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 07:03 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2017, vBulletin Solutions, Inc.