installshield 2010之 安装包安装和卸载过程中如何注册和反注册dll或者ocx
1, 选择behavior and logic->InstallScript
2, 然后右侧选中对应的feature, 然后在旁边的下来框中选择installed 和uninstalled
3. 分别再installed和uninstalled函数中添加注册相关代码
export prototype DefaultFeature_UnInstalled();
function DefaultFeature_UnInstalled()
string svPath;
begin
svPath = TARGETDIR ^ "mytest.dll";
//LongPathToShortPath ( svPath );
if (LaunchAppAndWait ("regsvr32"," -s /u"+ " \"" + svPath + "\"", WAIT)< 0) then
MessageBox("卸载OCX失败", SEVERE);
abort;
endif;
end;
//---------------------------------------------------------------------------
// The Installed event is sent after the feature NewFeature1
// is installed.
//---------------------------------------------------------------------------
export prototype NewFeature1_Installed();
function NewFeature1_Installed()
string svPath;
begin
svPath = TARGETDIR ^ "\\mytest.dll";
if (LaunchAppAndWait ("regsvr32"," -s /u"+ " \"" + svPath + "\"", WAIT)< 0) then
MessageBox("注册文件自动注册失败", SEVERE);
abort;
endif;
if (LaunchAppAndWait ("regsvr32"," -s "+ " \"" + svPath + "\"", WAIT)< 0) then
MessageBox("注册文件自动注册失败", SEVERE);
abort;
endif;
end;