1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Donation with Paypal!!!

    Go to your paypal account and send directly donation to [email protected]

    1 month - 10 $ - Standart VIP

    6 months - 20 $- Standart VIP

    1 year - 30 $- Standart VIP

    2 years - 50 $- Standart VIP

    Gold member for life - 150 $- Standart VIP

    High Vip (Standart VIP include) group please send PM or email to [email protected] for info

    After Donation please send email to [email protected]

  3. Donation Ways 2020


    Paysend
  4. Telegram
Dismiss Notice

Donation with Paypal!!!

Go to your paypal account and send directly donation to [email protected]

1 month - 10 $ - Standart VIP

6 months - 20 $- Standart VIP

1 year - 30 $- Standart VIP

2 years - 50 $- Standart VIP

Gold member for life - 150 $- Standart VIP

High Vip (Standart VIP include) group please send PM or email to [email protected] for info

After Donation please send email to [email protected]

Dismiss Notice
For open hidden message no need write thanks, thank etc. Enough is click to like button on right side of thread.

ExecAndWait

Discussion in 'Delphi Programming' started by saedi_mehdi, Dec 2, 2013.

  1. saedi_mehdi
    Offline

    saedi_mehdi DF Junior

    if you need run a program and wait...

    procedure ExecAndWait(const FileName, Params: String; const CmdShow: Integer);
    var
      exInfo: TShellExecuteInfo;
      Ph: DWORD;
    begin
      FillChar(exInfo, SizeOf(exInfo), 0);
      with exInfo do
      begin
        cbSize := SizeOf(exInfo);
        fMask := SEE_MASK_NOCLOSEPROCESS or SEE_MASK_FLAG_DDEWAIT;
        Wnd := GetActiveWindow();
        ExInfo.lpVerb := 'open';
        ExInfo.lpParameters := PChar(Params);
        lpFile := PChar(FileName);
        nShow := CmdShow;
      end;
      if ShellExecuteEx(@exInfo) then
        Ph := exInfo.HProcess
      else
      begin
        ShowMessage(SysErrorMessage(GetLastError));
        Exit;
      end;
      while WaitForSingleObject(ExInfo.hProcess, 50) <> WAIT_OBJECT_0 do
        ProcessMessages;
      CloseHandle(Ph);
    end;
     
    asachanr likes this.
  2. adilbertofarramilo
    Offline

    adilbertofarramilo DF Member

Share This Page