请问诸位高手,我想执行当前目录下的一个EXE文件,需要怎样做才可以实现?
谢谢。
谢谢。
解决方案 »
- 关于delphi中图片压缩的问题
- 当我查看某个窗体时提示TRMReport类没有找到是怎么回事?
- 关于pagecontrol的问题?????
- ocx控件可以反编译吗?用dede?怎么做啊?
- 关于MDI窗体前显示登陆窗体的问题!
- 权限高手进来啊!考验你们的时间到了(关于ActionList或 ActionManager 另类用法)
- DBEDIT中下拉显示另一个表中的字段值。
- 在Delphi或js中怎么用access的参数查询?
- 无失真或小失真的图象放大算法讨论!
- 请问如何移动TTreeView中的NodeItem到树形列表中的其他位置? --解决立即送分
- Delphi有没有悾件数组的概念,象VB那样。若有,怎么用?若您第一个回答正确,奉送50分
- 请问,如何安装及使用 ActiveBar 2.0 和 True DBGird Pro 7.0
ShellExecute(0,'open','calc.exe','','', SW_SHOW );
LPCTSTR lpOperation, // pointer to string that specifies operation to perform
LPCTSTR lpFile, // pointer to filename or folder name string
LPCTSTR lpParameters, // pointer to string that specifies executable-file parameters
LPCTSTR lpDirectory, // pointer to string that specifies default directory
INT nShowCmd // whether file is shown when opened
);查查help下面的WINDOWS SDK
ShellExecute,可以启动某一可执行程序,也可以启动与你给出的文件相关联的应用程序;
ShellExecuteEx,和上两者相似,不过传递的参数不一样。
ShellExecute,可以启动某一可执行程序,也可以启动与你给出的文件相关联的应用程序;
ShellExecuteEx,和上两者相似,不过传递的参数不一样。
例:E:\data\mm.exe
执行:
winexec(ExeFileName,SW_SHOWDEFAULT);
path:=ExtractFilePath(Application.ExeName)+'abc.exe'; winexec(path);
shellexceute;
shellexceute 需要加入shellipa单元
ShellExecute(handle,'open','readme.txt','','', SW_SHOWNORMAL);
var
path:PChar;
begin
//ce为当前目录下的那个文件夹
path:=Pchar(ExtractFilePath(Application.ExeName)+'ce\calc.exe');
ShellExecute(handle,'open',path,'','', SW_SHOWNORMAL);
end;
var
path:PChar;
begin
//ce为当前目录下的那个文件夹
path:=Pchar(ExtractFilePath(Application.ExeName)+'ce\calc.exe');
ShellExecute(handle,'open',path,'','', SW_SHOWNORMAL);
end;
程序调试通过,calc.exe为ce目录下的计算器程序
那个可执行目录你可以自己定义
就可以编译通过!
如下
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,shellapi;//就加在这边就OK了