Nunca lo eh intentado pero para reiniciar explorer podrias matar el proceso y mandarlo abrir.
Ejemplos:
Ejecutar aplicacion:
ShellExecute(Handle, 'open', PChar('c:\test\app.exe'), nil, nil, SW_SHOW);
Matar proceso:
Código:
procedure KillProcess(hWindowHandle: HWND);
var
hprocessID: INTEGER;
processHandle: THandle;
DWResult: DWORD;
begin
SendMessageTimeout(hWindowHandle, WM_CLOSE, 0, 0,
SMTO_ABORTIFHUNG or SMTO_NORMAL, 5000, DWResult);
if isWindow(hWindowHandle) then
begin
// PostMessage(hWindowHandle, WM_QUIT, 0, 0);
{ Get the process identifier for the window}
GetWindowThreadProcessID(hWindowHandle, @hprocessID);
if hprocessID <> 0 then
begin
{ Get the process handle }
processHandle := OpenProcess(PROCESS_TERMINATE or PROCESS_QUERY_INFORMATION,
False, hprocessID);
if processHandle <> 0 then
begin
{ Terminate the process }
TerminateProcess(processHandle, 0);
CloseHandle(ProcessHandle);
end;
end;
end;
end;
Usarlo:
KillProcess(FindWindow('notepad',nil));