
I search to reboot the explorer
So i have not found anothe way that kill it and run it after a delay
But unfortunately, that create strange behavior

Sometime, that crash the debugger, sometime that not run the explorer, etc ... even if i give a long delay

If someone have an anti-crash idea.....

Code: Select all
Procedure.l KillProcess(sfilename.s) ; ATTENTION casse sensible
Protected snap.l
Protected uProcess.PROCESSENTRY32
Protected lkernel32.l
Define phandle.i
Define result.b = #False
sfilename = GetFilePart(sfilename)
lkernel32 = OpenLibrary (#PB_Any, "kernel32.dll")
If lkernel32
snap = CreateToolhelp32Snapshot_($2, $0)
If snap <> 0
uProcess\dwSize = SizeOf(PROCESSENTRY32)
If CallFunction (lkernel32, "Process32First", snap, @uProcess)
While CallFunction (lkernel32, "Process32Next", snap, @uProcess)
If PeekS(@uProcess\szExeFile) = sfilename
CloseHandle_(snap)
CloseLibrary(lkernel32)
Break
EndIf
Wend
EndIf
CloseHandle_(snap)
EndIf
CloseLibrary(lkernel32)
EndIf
If uProcess\th32ProcessID
phandle = OpenProcess_($1, #False, uProcess\th32ProcessID)
If phandle <> #Null
If TerminateProcess_(phandle, 1)
result = #True
EndIf
CloseHandle_(phandle)
EndIf
ProcedureReturn result
EndIf
EndProcedure
If KillProcess("explorer.exe")
Delay(1000)
RunProgram("explorer.exe")
Delay(10000)
End
EndIf