Hallo!
Ich habe ein Problem mit shellexecute. Ich habe hier eine neuere Version davon(Um zu warten):
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31:
| function ShellExecuteAndWaitW(hWnd: HWND; Operation, FileName, Parameters, Directory: PWideChar; ShowCmd: Integer; bWait: BOOL): HINST; stdcall; var sei: TShellExecuteInfoW; begin ZeroMemory(@sei, sizeof(sei)); with sei do begin cbSize := sizeof(sei); fMask := SEE_MASK_NOCLOSEPROCESS; Wnd := hWnd; lpVerb := Operation; lpFile := FileName; lpParameters := Parameters; lpDirectory := Directory; nShow := ShowCmd; end; if ShellExecuteExW(@sei) then try if bWait then WaitForSingleObject(sei.hProcess, INFINITE); finally CloseHandle(sei.hProcess); end; result := sei.hInstApp; end; |
So wollte ich eigentlich das Programm starten:
Delphi-Quelltext
1:
| ShellExecuteAndWaitW(Application.Handle, nil, 'command', '/c d1.exe 0<datfile 1>datfile.bho' ,PWidechar(extractfilepath(Application.ExeName)), SW_Show, true); |
Klappt nur nicht, sondern das Programm bleibt hängen. Nur wenn ich das Verzeichniss direkt angebe klappst.
Hat einer ne Idee wie ich das Programm so starten kann, wie oben angegeben?
Danke!