各位大哥:怎样能通过一个按钮调用已经存在的exe或bat文件,使其能过通过点击该按钮运行这些文件。谢谢
解决方案 »
- delphi fastreport 2.4低版本转高版本用什么软件转?
- 请问一下,我想把panel控件中的,所有子控件,保存为流文件,在读出来,请大家帮忙.
- fastreport的打印问题(分组并分栏)急急!!!
- TWebBrowser控件,用ExecWB调用“另存为……”时,如何指定另存为的名字?
- 求教DELPHI中关于QUERY里面的SQL语句问题?
- ???※※※※[Delphi 不可完成的打印任务高手们来看看!(200)分]※※※※※※???
- 首次用Socket编程,菜鸟问题!在线等待!!!
- 最新C6/D6插件:YExperts,大家快来下载...
- delphi的缺省别名dbdemos怎么不识别?
- delphi6.0的数据库登录问题?
- 在直接继承TImage的自定义控件中override Paint事件,为什么在paint中陷入循环?
- 请大家帮忙,在线等待,关于统计字数
shellexecute;
这种问题论坛每天都有问的,你看下
ShellExecute(Handle,'open',PChar('c:\test\app.exe'),nil,nil,SW_SHOW);Winexec(pchar('noptepad'),sw_restore);
ShellExecute(Handle, 'open', PChar(你需要调用的EXE或者BAT文件的路径), nil,nil,SW_SHOW);搞定
//执行处部可执行文件
Function LaunchApp(pExePath,WorkDir:String;ShowWindow,WaitFlag:Boolean):Boolean;
var ExePath : array[0..512] of char;
StartupInfo:TStartupInfo;
ProcessInfo:TProcessInformation;
begin
StrPCopy(exePath, pExePath);
FillChar(StartupInfo,Sizeof(StartupInfo),#0);
StartupInfo.cb := Sizeof(StartupInfo);
StartupInfo.dwFlags := STARTF_USESHOWWINDOW;
if ShowWindow then
StartupInfo.wShowWindow := 1
else
StartupInfo.wShowWindow := 0;
if not CreateProcess(nil,
ExePath,
nil,
nil,
false,
CREATE_NEW_CONSOLE or
NORMAL_PRIORITY_CLASS,
nil,
nil,
StartupInfo,
ProcessInfo) then begin
Result:=False;
Exit;
end else begin
if WaitFlag then
WaitforSingleObject(ProcessInfo.hProcess,INFINITE);
Result:=True;
end;
end;
查一下了
uses ShellAPI;
ShellExecute(Handle, 'open', PChar(你需要调用的EXE或者BAT文件的路径), nil,nil,SW_SHOW);