Registriert seit: 17. Mai 2007
482 Beiträge
Delphi XE6 Professional
|
Re: (Re)start explorer.exe
23. Sep 2011, 15:30
This is my source. How can improve it?
Delphi-Quellcode:
var
hWnd, hProc: Cardinal;
pId: DWORD;
begin
Result := False;
hWnd := FindWindow('Progman', 'Program Manager');
GetWindowThreadProcessId(hWnd, @pId);
hProc := OpenProcess(PROCESS_TERMINATE, False, pId);
if hProc <> 0 then
begin
Result := TerminateProcess(hProc, 0);
if Result then
begin
CloseHandle(hProc);
if FindWindow('Progman', nil) = 0 then
ShellExecute(HInstance, 'open', 'explorer', nil, nil, SW_NORMAL)
;
end;
end;
end;
|
|
Zitat
|