| |
|
|
|
Description:
declared TerminateProcess exits whom angegebenen Process, entlädt however no loaded DLL’s.
Deklaration:
Def @TerminateProcess(2) !KERNEL32,TerminateProcess
Parameter:
1.Parameter: lever the Prozesses 2.Parameter: LongInt Variable with the Exitcode for Process.
Return Value:
0 with failure, otherwise 1.
Examples:
[...] CompileMarkSeparationDEF CreateProcessA(10) ! "Kernel32","CreateProcessA"
DEF GetExitCodeProcess(2) ! "Kernel32","GetExitCodeProcess"
DEF TerminateProcess(2) ! "Kernel32","TerminateProcess"
DEF ZeroMemory(2) ! "Kernel32","RtlZeroMemory"
Declare lpCommandLine#
Declare lpStartupInfo#
Declare lpProcessInformation#
Declare ExitCode#
Declare Prozess$
Proc CreateProcess
Parameters CommandLine$,Showparameter$,XPOS$,YPOS$,XSIZE$,YSIZE$
Declare hProcess&,Flags&
Dim lpCommandLine#,Len(CommandLine$)+1
Dim lpStartupInfo#,68
ZeroMemory(lpStartupinfo#,68)
Long lpStartupInfo#,0=68
Case Showparameter$<>"" : LET FLAGS&=FLAGS&+1
CASE @OR(XPOS$<>"",YPOS$<>"") : LET FLAGS&=FLAGS&+4
CASE @OR(XSIZE$<>"",YSIZE$<>"") : LET FLAGS&=FLAGS&+2
Long lpStartupInfo#,44=Flags& Flag, welche Anteile von Startupinfo berücksichtigt werden sollen
Word lpStartupInfo#,48=@VAL(Showparameter$) SHOWParameter von WinExec
Long lpStartupInfo#,16=@VAL(XPOS$) Einleuchtend - oder?
Long lpStartupInfo#,20=@VAL(YPOS$) Einleuchtend - oder?
Long lpStartupInfo#,24=@VAL(XSIZE$) Einleuchtend - oder?
Long lpStartupInfo#,28=@VAL(YSIZE$) Einleuchtend - oder?
Dim lpProcessInformation#,16
ZeroMemory(lpProcessInformation#,16)
String lpCommandLine#,0=CommandLine$
CreateProcessA(0,lpCommandLine#,0,0,0,0,0,0,lpStartupInfo#,lpProcessInformation# )
hProcess&=Long(lpProcessInformation#,0)
Dispose lpCommandLine#
Dispose lpStartupInfo#
Dispose lpProcessInformation#
Return hProcess&
EndProc
Proc KillProcess
Parameters hProcess&
GetExitCodeProcess(hProcess&,Exitcode#)
TerminateProcess(hProcess&,Long(exitcode#,0))
Dispose Exitcode#
EndProc
Proc ProcessStatus
parameters prozid&
declare status&
GetExitCodeProcess(prozid&,Exitcode#)
status& = long(Exitcode#,0)
return status&
endproc
Declare hProcess&
LET PROZESS$=@LOADFILE$("Datei auswählen","*.EXE")
CASE PROZESS$="" : END
Dim exitcode#,4
createprocess PROZESS$,"0","","","","" Prozess versteckt
createprocess PROZESS$,"1","100","30","200","100" Prozess sichtbar
createprocess PROZESS$,"2","10","30","400","400" Prozess minimiert
LET hProcess& = @&(0)
Windowstyle 31+512
WindowTitle "Prozess überwachen"
Window 0,0-640,440
settimer 400
while %MENUITEM<>-2
waitinput
ProcessStatus hProcess&
print @&(0)
print hex$(long(Exitcode#,0))
endwhile
KillProcess hProcess&
Dispose xitcode#
End
[keywords:96a8ffacd3] Process Program task terminate killen [/keywords:96a8ffacd3] |
|
|
| |
|
|