copying files w/ GetWindowsDirectory


[ DelphiLand FAQ ] [ Delphi Tutorials ]

Posted by p12174 Doug on November 03, 2001 at 09:31:59:

i have some code that i've been working on, utilizing the "GetWindowsDirectory" parameters/functions, etc..

the code that i've been working with, is for like opening a file in the \system32 directory of the end user(s) system, without actually knowing the user(s) drive/directory that they installed nt4/2000/xp to..
(like they could be using the D: drive, as well as a different name, than the default for their nt4/2000/xp installation.

here's my sample code:

procedure TForm1.Button1Click(Sender: TObject);
var
  WinName : String; WindowsDir : Array[0..Max_Path] of Char;
begin
  GetWindowsDirectory(WindowsDir, Max_Path); 
  WinName := StrPas(WindowsDir);
  Memo1.Lines.LoadFromFile(WinName + '\system32\filename.txt');
  Label1.Caption := WinName + '\system32\filename.txt';
end;
end.
****************************************************

what i'm trying to figure out is this.. how to use the GetWindowsDirectory, but instead of opening a file, "copying" a predetermined/specific file to the "\system32" directory of the users WindowsDir, etc..

any suggestions?

i'd love to find a reference somewhere or another on the "GetWindowsDirectory" functions, etc.. and others or similar one's in it's class as well..
(i can't find any reference to it in my Object pascal language reference, or any of my other delphi books that i have..


Related Articles and Replies


[ DelphiLand FAQ ] [ Delphi Tutorials ]