Restored from previous forum. Originally posted by cisc.
yeah it works now. Here´s the code:
Code: Select all
#STANDARD_RIGHTS_REQUIRED = $000F0000
#SYNCHRONIZE = $00100000
#PROCESS_ALL_ACCESS = #STANDARD_RIGHTS_REQUIRED+#SYNCHRONIZE+$0FFF
ProgEins.s="D:\\spamproxy\SPAMPRXY.EXE"
WinTitleEins.s="SpamProxy (Alpha)"
ProgZwei.s = "D:\\outlook express\MSIMN.EXE"
Ergebnis = RunProgram(ProgEins)
;MessageRequester("Info",Str(Ergebnis),0)
Ergebnis = RunProgram(ProgZwei,"","",1)
;If Ergebnis=0
; MessageRequester("Done?", WinTitleZwei+" scheisse", 0)
;EndIf
ProcessId.l
ExitCode.l
hWindow = FindWindow_(0, WinTitleEins)
If hWindow =0
MessageRequester("Done?", WinTitleEins+" scheisse", 0)
Goto aus
EndIf
Ergebnis = GetWindowThreadProcessId_(hWindow, @ProcessId)
If Ergebnis=0
MessageRequester("Done?", Str(hWindow)+" Window scheisse", 0)
Goto aus
EndIf
hProcess = OpenProcess_(#PROCESS_ALL_ACCESS, #TRUE, ProcessId)
If Ergebnis=0
MessageRequester("Done?", Str(hProcess)+" Process scheisse", 0)
Goto aus
EndIf
If GetExitCodeProcess_(hProcess, @ExitCode) = 0
MessageRequester("Done?", Str(hProcess)+" GetExitCodeProcess scheisse", 0)
Goto aus
EndIf
;ExitProcess_(ExitCode) 0
If TerminateProcess_(hProcess, ExitCode)
MessageRequester("Done?", "has been killed.", 0)
Else
MessageRequester("Done?", Str(hProcess)+" TerminateProcess scheisse", 0)
EndIf
aus:
End
The only little blemish is the icon from SpamProxy remaining in the info bar until mouse is moved over. Seems, terminating the process is not the very best - but how else can it be stopped?

cisc