newsanti Posted January 29, 2025 Posted January 29, 2025 This error occurs only when the command below is used. procedure TisteeUniCustomExeProcessItem.DoRun; var ahwnd: HWND; sInfo: TStartupInfo; pInfo: TProcessInformation; CmdLine: PChar; oPath: string; ErrorCode : DWORD; CreateOK : Boolean; begin inherited; oPath:= ExtractFilePath(ParamStr(0)); //ExeName if Hidden then sInfo.wShowWindow:= SW_HIDE else sInfo.wShowWindow:= SW_SHOW; sInfo.dwXSize:=0; sInfo.dwYSize:=0; CmdLine:= PChar('"'+FileName+'" '+Parameters); FillChar(sInfo, sizeof(TStartupInfo), 0); sInfo.cb := sizeof(TStartupInfo); sInfo.dwFlags := STARTF_FORCEONFEEDBACK or STARTF_FORCEOFFFEEDBACK; CreateOK:= Winapi.Windows.CreateProcess(Nil,CmdLine,nil,nil,False, CREATE_DEFAULT_ERROR_MODE or CREATE_NEW_PROCESS_GROUP or NORMAL_PRIORITY_CLASS, nil, PChar(oPath), sInfo, pInfo ); if CreateOK then begin ahwnd:= pInfo.dwProcessId; PID:= ahwnd; if Wait then begin WaitForSingleObject(ahwnd, INFINITE); CloseHandle(pInfo.hProcess); CloseHandle(pInfo.hThread); end; GetExitCodeProcess(pInfo.hProcess, ErrorCode); CellReturn := ErrorCode; end; end; Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.