Navigation Menu Search PhysiologyWeb
PhysiologyWeb Logo Search PhysiologyWeb
   
— share —
Share on Facebook    Share on X    Share on LinkedIn    Share on Pinterest    Share on Reddit    Email    Copy URL
function Get_Microsoft_System_Information_File: String;
var
SystemPath, WindowsPath: array[0..MAX_PATH] of Char;
SystemInfoFilename, WinPath, SysPath: String;
WindowsRegistry: TRegistry;
begin
Get_Microsoft_System_Information_File := '';
SystemInfoFilename := '';
WinPath := '';
SysPath := '';

//first method
WindowsRegistry := TRegistry.Create;
WindowsRegistry.RootKey := HKEY_LOCAL_MACHINE;
If WindowsRegistry.OpenKeyReadOnly('Software\Microsoft\Shared Tools\MSInfo') then
begin
SystemInfoFilename := WindowsRegistry.ReadString('Path');
end;
WindowsRegistry.CloseKey;
WindowsRegistry.Free;

//second method
If SystemInfoFilename = '' then
begin
SystemInfoFilename := FindFileFullPath('msinfo32.exe', 'C:\Program Files\Common Files\Microsoft Shared\MSInfo');
end;

//third method
If SystemInfoFilename = '' then
begin
GetSystemDirectory(SystemPath, MAX_PATH);
SysPath := String(SystemPath);
SystemInfoFilename := FindFileFullPath('msinfo32.exe', SysPath);
end;

//fourth method
If SystemInfoFilename = '' then
begin
GetSystemDirectory(WindowsPath, MAX_PATH);
WinPath := String(WindowsPath);
SystemInfoFilename := FindFileFullPath('msinfo32.exe', WinPath);
end;

If (SystemInfoFilename <> '') and (FileExists(SystemInfoFilename) = True) and (AnsiContainsText(SystemInfoFilename, 'msinfo') = True) and (AnsiEndsText('.exe', SystemInfoFilename) = True) then
begin
ShellExecute(Application.Handle, PChar('open'), PChar(SystemInfoFilename), nil, nil, SW_SHOWNORMAL);
Get_Microsoft_System_Information_File := SystemInfoFilename;
end;
end;




Posted: Sunday, January 7, 2024
Last updated: Tuesday, March 18, 2025
— share —
Share on Facebook    Share on X    Share on LinkedIn    Share on Pinterest    Share on Reddit    Email    Copy URL