码迷,mamicode.com
首页 > 其他好文 > 详细

模态运行EXE程序

时间:2015-08-21 19:03:50      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:

function ExecShowModal(APath: PChar; ACmdShow: Integer; ATimeout: Longword): Integer;
var
  vStartupInfo: TStartupInfo;
  vProcessInfo: TProcessInformation;
begin
  FillChar(vStartupInfo, SizeOf(TStartupInfo), 0);
  with vStartupInfo do
  begin
    cb := SizeOf(TStartupInfo);
    dwFlags := STARTF_USESHOWWINDOW or STARTF_FORCEONFEEDBACK;
    wShowWindow := ACmdShow;
  end;
  if CreateProcess(nil, APath, nil, nil, False,
    NORMAL_PRIORITY_CLASS, nil, nil,
    vStartupInfo, vProcessInfo) then
    Result := WaitForSingleObject(vProcessInfo.hProcess, ATimeout)
  else Result := GetLastError;
end;



procedure TForm1.Button3Click(Sender: TObject);
begin
  ExecShowModal(notepad.exe, SW_SHOW, INFINITE);
end;

参考:http://www.cnblogs.com/key-ok/p/3358855.html

模态运行EXE程序

标签:

原文地址:http://www.cnblogs.com/findumars/p/4748662.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!