请问诸位高手,我想执行当前目录下的一个EXE文件,需要怎样做才可以实现?
谢谢。
谢谢。
解决方案 »
- 关于TDBGridhEh控件添加复选框
- @OutList[0]和OutList区别是什么
- 如何判断系统中安装的是Office 2000、Office XP 还是 Office 2003?
- 自认为是高难度问题,高手请进,看是否有办法解决,谢谢!
- 关于窗体中内置webbrowser的问题(本例子程序下载地址 http://web.ppcol.com/test.rar )
- 编译时出现‘symbol 'TRzToolbarButton' is deprecated’的错误提示,是什么意思 ?
- 数值转换
- 为什么我做的activeform不能别的机器上用
- 精神空虚,散分。
- 字符串变量s的值为'111111'#$D#$A怎样把它弄成s的值为'111111'
- 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了