Lazarus中文社区

 找回密码
 立即注册(注册审核可向QQ群索取)

QQ登录

只需一步,快速开始

版权申明
查看: 2776|回复: 2

lazarus怎样启动另一个程序

[复制链接]

该用户从未签到

发表于 2015-4-11 20:22:56 | 显示全部楼层 |阅读模式
使用ShellExecute总提示没有这个函数,WinExec也是这样,具体怎样添加呢?
回复

使用道具 举报

该用户从未签到

发表于 2015-4-13 08:25:33 | 显示全部楼层
uses ..., ShellApi;
回复 支持 反对

使用道具 举报

该用户从未签到

发表于 2015-4-14 15:54:20 | 显示全部楼层
function WinExecAndWait32(FileName: string;isWairing:boolean=false): integer;
var
  zAppName: array[0..512] of Widechar; //存放应用程序名
begin
  StrPCopy(zAppName, FileName);
  //调用CreateProcess 创建进程,执行指定的可执行文件
  CreateProcess(zAppName, nil, nil, nil, false, 0 , nil, nil, nil, nil)
  //and isWairing then
  //  Result := -1
  //else  begin
  //  //等待可执行文件退出
  //  WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
  //  //得到进程终止状态码
  //  GetExitCodeProcess (ProcessInfo.hProcess, exitCode);
  //  result := exitCode;
  //end;
end;

测试成功的!
回复 支持 反对

使用道具 举报

*滑块验证:

本版积分规则

QQ|手机版|小黑屋|Lazarus中国|Lazarus中文社区 ( 鄂ICP备16006501号-1 )

GMT+8, 2025-5-2 21:16 , Processed in 0.028678 second(s), 10 queries , Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表