procedure TForm1.Button2Click(Sender: TObject); var Buf: array [0..255] of Char; begin Windows.GetWindowsDirectory(Buf, SizeOf(Buf)); ShowMessage(StrPas(Buf)); end;
1 获取系统所在的盘符: function GetSystemDisk():Char; var Path:PChar; begin GetMem(Path,255); GetSystemDirectory(Path, 255); Result:=Path[0]; FreeMem(Path); end;2 调用msconfig.exe ,记住要加uese ShellAPI ShellExecute(Handle,'open','msconfig.exe','','',SW_SHOW);
var
Buf: array [0..255] of Char;
begin
Windows.GetWindowsDirectory(Buf, SizeOf(Buf));
ShowMessage(StrPas(Buf));
end;
function GetSystemDisk():Char;
var Path:PChar;
begin
GetMem(Path,255);
GetSystemDirectory(Path, 255);
Result:=Path[0];
FreeMem(Path);
end;2 调用msconfig.exe ,记住要加uese ShellAPI
ShellExecute(Handle,'open','msconfig.exe','','',SW_SHOW);
获得exe文件所在的路径