Autor: Karl-Jürgen Hilger (---.77.1.pool.telefonica.de)
Datum: 19.04.22 18:29
Ragnar Rehbein hatte hier im Jahre 2005 einen Beispielcode für CreateProcess
gepostet.
Einen Teil davon hab ich erfolglos für folgenden Test genommen.
DEF CreateProcessA(10) ! "Kernel32","CreateProcessA"
DEF GetExitCodeProcess(2) ! "Kernel32","GetExitCodeProcess"
DEF TerminateProcess(2) ! "Kernel32","TerminateProcess"
DEF ZeroMemory(2) ! "Kernel32","RtlZeroMemory"
DEF CloseHandle(1) ! "Kernel32","CloseHandle"
Declare lpCommandLine#
Declare lpStartupInfo#
Declare lpProcessInformation#
Declare ExitCode#
Declare Comline$
Declare handle hPrg
Proc CreateProcess
Parameters CommandLine$
Declare hProcess&
Dim lpCommandLine#,Len(CommandLine$)+1
Dim lpStartupInfo#,68
ZeroMemory(lpStartupinfo#,68)
Long lpStartupInfo#,0=68
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
ComLine$ = "e:\\!GAME\\ARMA Cold War Assault\\ColdWarAssault.exe"
hPrg = CreateProcess(Comline$)
CLS
Print hPrg
WaitInput
Es kommt ein Processhandle, aber sonst nix.
ABer auch schon mit den Profan-Befehlen gab es positive Rückgabewerte, ohne daß etwas passierte.
|
|