我用INNO SETUP打包,写了一个[Code]段[Code]var
CheckBox: TCheckBox;
ErrorCode: Integer;
function OnWizardNext(Sender:TWizardPage):Boolean;
begin
if CheckBox.State=cbChecked then
begin
ShellExec('open','http://www.abc.com/','','',SW_SHOWNORMAL, ewNoWait, ErrorCode);
//?????????????????????????????????????????????????????????????????????????????
end;
Result:=True;
end;
procedure InitializeWizard();
var
Page: TWizardPage;
Labecaption: TLabel;
BitmapImageIe: TBitmapImage;
BitmapFileName: String; begin
Page := CreateCustomPage(wpInstalling, '运行ABC', '运行我的程序ABC。');
Page.OnNextButtonClick:=@OnWizardNext
CheckBox := TCheckBox.Create(Page);
CheckBox.left := 4;
CheckBox.Top := 45;
CheckBox.Width := 273;
CheckBox.Height := 17;
CheckBox.Caption := '运行ABC。';
CheckBox.Checked := True;
CheckBox.Parent := Page.Surface;
end;运行上边的程序打包,可以在制作的安装程序“安装”过程中,打钩时就连接到http://www.abc.com/网站,
不过,我如果想运行已经安装的一个文件,这个文件的位置及文件名为:{app}\ABC.exe用ShellExec('open','{app}\ABC.exe','','',SW_SHOWNORMAL, ewNoWait, ErrorCode); 就没有效果,也没有错误信息出现。
如何能让打钩后运行{app}\ABC.EXE文件呢,请教了
CheckBox: TCheckBox;
ErrorCode: Integer;
function OnWizardNext(Sender:TWizardPage):Boolean;
begin
if CheckBox.State=cbChecked then
begin
ShellExec('open','http://www.abc.com/','','',SW_SHOWNORMAL, ewNoWait, ErrorCode);
//?????????????????????????????????????????????????????????????????????????????
end;
Result:=True;
end;
procedure InitializeWizard();
var
Page: TWizardPage;
Labecaption: TLabel;
BitmapImageIe: TBitmapImage;
BitmapFileName: String; begin
Page := CreateCustomPage(wpInstalling, '运行ABC', '运行我的程序ABC。');
Page.OnNextButtonClick:=@OnWizardNext
CheckBox := TCheckBox.Create(Page);
CheckBox.left := 4;
CheckBox.Top := 45;
CheckBox.Width := 273;
CheckBox.Height := 17;
CheckBox.Caption := '运行ABC。';
CheckBox.Checked := True;
CheckBox.Parent := Page.Surface;
end;运行上边的程序打包,可以在制作的安装程序“安装”过程中,打钩时就连接到http://www.abc.com/网站,
不过,我如果想运行已经安装的一个文件,这个文件的位置及文件名为:{app}\ABC.exe用ShellExec('open','{app}\ABC.exe','','',SW_SHOWNORMAL, ewNoWait, ErrorCode); 就没有效果,也没有错误信息出现。
如何能让打钩后运行{app}\ABC.EXE文件呢,请教了
; 脚本用 Inno Setup 脚本向导生成。
; 查阅文档获取创建 INNO SETUP 脚本文件详细资料![Setup]
AppName=我的程序
AppVerName=我的程序 1.5
AppPublisher=我的公司
AppPublisherURL=http://www.mycompany.com
AppSupportURL=http://www.mycompany.com
AppUpdatesURL=http://www.mycompany.com
DefaultDirName={pf}\我的程序
DefaultGroupName=我的程序
Compression=lzma
SolidCompression=yes[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
;在这里增加一句话
Name: RunABC; Description: {cm:RunABC}
[Files]
Source: "C:\Program Files\Inno Setup 4\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion
; 注意: 不要在任何共享系统文件中使用“Flags: ignoreversion”[Icons]
Name: "{group}\我的程序"; Filename: "{app}\MyProg.exe"
Name: "{userdesktop}\我的程序"; Filename: "{app}\MyProg.exe"; Tasks: desktopicon[Run]
Filename: "{app}\MyProg.exe"; Description: "{cm:LaunchProgram,我的程序}"; Flags: nowait postinstall skipifsilent
;在这里增加一句话
Filename: {app}\ABC.exe; Tasks: RunABC;在这里增加一句话
[CustomMessages]
RunABC="运行ABC.exe"
如果将上边的ShellExec('open','http://www.abc.com/','','',SW_SHOWNORMAL, ewNoWait, ErrorCode);
//????????????????????????????????????????????????????????????????????????????? 改成
ShellExec('open','c:\ABC.exe','','',SW_SHOWNORMAL, ewNoWait, ErrorCode);
也是可以运行的,就是说这个地方好像需要绝对路径,如果用上了{app}\ABC.exe就不行了。
这个问题可以解决么?
来运行,关键是???如何写,PASCAL语言我不太懂
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2、用RegQueryStringValue读取该注册键值,得到实际路径
3、用ShellExec加上实际路径运行EXE文件谢谢各位的参与。