![]() |
CreateProcess Verknüpfte Dateien öffnen
Hi,
ich starte externe Programme mit dieser Funktion:
Delphi-Quellcode:
Jedoch ist es mir mit dieser nicht Möglich Verknüpfte Dateien (z.B. C:\test.txt) zu öffnen. Brauch ich dazu Shellexecute oder geht das auch direkt mit CreatProcess?
function RunProcess(FileName: string; ShowCmd: DWORD; wait: Boolean; ProcIDRunProcess: PDWORD): TProcessInformation;
type TDWordList = Array of DWord; var StartupInfoRunProcess: TStartupInfoA; ProcessInfoRunProcess: TProcessInformation; begin FillChar(StartupInfoRunProcess, SizeOf(StartupInfoRunProcess), #0); StartupInfoRunProcess.cb := SizeOf(StartupInfoRunProcess); StartupInfoRunProcess.dwFlags := STARTF_USESHOWWINDOW or STARTF_FORCEONFEEDBACK; StartupInfoRunProcess.wShowWindow := ShowCmd; if not CreateProcessA(nil,@Filename[1],nil,nil,False, CREATE_BREAKAWAY_FROM_JOB or CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS,nil,nil,StartupInfoRunProcess,ProcessInfoRunProcess) then begin Result.hProcess := WAIT_FAILED; end else begin Result := ProcessInfoRunProcess; WaitForInputIdle(ProcessInfoRunProcess.hProcess, 30000); if wait = FALSE then begin //if ProcIDRunProcess <> nil then ProcIDRunProcess^ := ProcessInfoRunProcess.dwProcessId; exit; end; WaitForSingleObject(ProcessInfoRunProcess.hProcess, INFINITE); GetExitCodeProcess(ProcessInfoRunProcess.hProcess, Result.hProcess); end; if ProcessInfoRunProcess.hProcess <> 0 then CloseHandle(ProcessInfoRunProcess.hProcess); if ProcessInfoRunProcess.hThread <> 0 then CloseHandle(ProcessInfoRunProcess.hThread); end; EDIT: Habe es nun mit dieser Funktion zum laufen gebracht: ![]() Nun werden z.B. txt-Files im Notepad geöffnet! |
Re: CreateProcess Verknüpfte Dateien öffnen
Nein, dazu ist ja ShellExecute.
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 16:09 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