![]() |
CreateProcessWithLogonW Aufruf mit Übergabeparameter
Hallo zusammen
Ich habe ein Problem mit dem CreateProcessWithLogonW Aufruf. Mein Code sieht folgendermassen aus:
Delphi-Quellcode:
Variante 1 funktioniert problemlos. Die Variante 2 mit dem Übergabeparameter funktioniert aber leider nicht.
function CreateProcessWithLogonW(
lpUsername, lpDomain, lpPassword:PWideChar; dwLogonFlags:dword; lpApplicationName: PWideChar; lpCommandLine: PWideChar; dwCreationFlags: DWORD; lpEnvironment: Pointer; lpCurrentDirectory: PWideChar; const lpStartupInfo: tSTARTUPINFO; var lpProcessInformation: TProcessInformation): BOOL; stdcall; external 'advapi32.dll'; {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); const //Variante 1 cFileName = 'C:\WINDOWS\NOTEPAD.EXE'; //Variante 2 cFileName = 'C:\WINDOWS\NOTEPAD.EXE "C:\Temp\test.txt"'; var _StartupInfo : TStartupInfo; _ProcessInfo : TProcessInformation; _lwResult : Longword; _WaitResult : integer; begin //-- set application appearance --- FillChar(_StartupInfo, SizeOf(_StartupInfo), #0); _StartupInfo.cb := SizeOf(StartupInfo); _StartupInfo.dwFlags := STARTF_USESHOWWINDOW; _StartupInfo.wShowWindow := 1; //--- create application --- if not CreateProcessWithLogonW( 'User' 'Domain', 'Password', 0, cFileName, nil, CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS, nil, nil, _StartupInfo, _ProcessInfo) then begin _lwResult := WAIT_FAILED; ShowMessageFmt( 'Create Process failed <%s>', [cFileName]); exit; end; _WaitResult := WaitForSingleObject(_ProcessInfo.hProcess, INFINITE); .... end; Kann mir jemand sagen, was ich falsch mache? Danke schon im Voraus. Gruess Fisti |
Re: CreateProcessWithLogonW Aufruf mit Übergabeparameter
Versuch es mal im lpCommandLine-Parameter statt in lpApplicationName.
|
Re: CreateProcessWithLogonW Aufruf mit Übergabeparameter
Wie in
![]() 1. lpApplicationName: "Der Name des Programms" lpCommandLine: "Die Parameter" 2. lpApplicationName: NIL lpCommandLine: "Der Name des Programms" + "Die Parameter". Siehe auch bei ![]() Gruss MichaM |
Re: CreateProcessWithLogonW Aufruf mit Übergabeparameter
Danke für die schnelle Antwort, hat prima geklappt :-D :-D
Gruss Fisti |
Alle Zeitangaben in WEZ +1. Es ist jetzt 15:48 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz