本文整理自网络,侵删。
procedure RunSysExe(const exeprocessname: String;exeTitle:String);var //引用单元shellapi OFile:String; HWndCalculator:HWnd;begin HWndCalculator:=FindWindow(nil,pwidechar(exeTitle)); if (HWndCalculator=0) then begin OFile:=exeprocessname; Shellexecute(application.handle,'Open',pchar(OFile),nil,pchar(ExtractFilePath(OFile)),SW_SHOWNORMAL); end;end;
用法:RunSysExe('calc.exe','计算器');
相关阅读 >>
[译]rad studio 10.4 新变化:面向控件的 vcl 样式管理
Delphi使用idtcpclient和idtcpserver相互发送数据
更多相关阅读请进入《Delphi》频道 >>