Jump to content

Recommended Posts

Posted

image.png.81ec41a04c4d61c317c43d47fe1305fc.png

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;
 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...