InstallShield高手请进

njlengjiang 2009-08-04 11:49:35
小弟用InstallShield2009制作了一个安装包,自己写了下卸载的脚本,使用的是ComponentRemoveAll()函数进行卸载,不过卸载后发现在安装文件夹中还是有几个组件没有卸载掉, 经过仔细观察发现这些组件下包含的文件与另外几个组件下的文件一样(文件名及大小相同),比如:tService.exe4组件与tService.exe5组件下的文件一样,只是Link路径不同
我想请教下高手怎样能将安装文件夹下的组件清理干净(后续给出卸载脚本,谢谢各位了)

function OnMaintUIBefore()
NUMBER nResult, nType;
STRING szTitle, szMsg, svDir, svResult, szCaption;
begin

Dlg_Start:
Disable(BACKBUTTON);
nType = SdWelcomeMaint(szTitle, szMsg, MODIFY);
Enable(BACKBUTTON);
if ( nType = REMOVEALL ) then
nResult = MessageBox( SdLoadString( IFX_MAINTUI_MSG ), MB_YESNO );
if (nResult != IDYES ) then
goto Dlg_Start;
endif;
endif;
nResult = NEXT;

Dlg_SdFeatureTree:
if (nType = MODIFY) then
szTitle = "";
szMsg = "";
nResult = SdFeatureTree(szTitle, szMsg, INSTALLDIR, "", 2);
if (nResult = BACK) goto Dlg_Start;
endif;

switch(nType)
case REMOVEALL:
ComponentRemoveAll();
SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_MAINTUI_REMOVEALL ));

case REPAIR:
ComponentReinstall();
SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_MAINTUI_REPAIR ) );

case MODIFY:
SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_MAINTUI_MODIFY ) );
endswitch;

SetStatusWindow(0, "");
Enable(STATUSEX);
StatusUpdate(ON, 100);
end;
...全文
162 点赞 收藏 6
写回复
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
Javeson 2011-06-28
DeleteDir ( TARGETDIR , ALLCONTENTS );
回复
njlengjiang 2009-08-05
没有大虾能解决下小弟的问题吗????
回复
Denislu 2009-08-05
你使用一下上面写的卸载快捷方式,另外我对你components添加文件的Link Type表示怀疑,请使用Dynamic链接方式,可能不会出现该问题
回复
Denislu 2009-08-05
function LM_UninstallShortKey()
STRING szFolderName,szProgram,szWorkingDir,strTemp,strLanguage;
STRING strCmdLine, strUninstallCmdLine;
NUMBER num;
begin
strCmdLine = DISK1TARGET ^ "setup.exe";
LongPathToQuote( strCmdLine, TRUE );
UNINSTALL_STRING = strCmdLine;

strUninstallCmdLine = UNINSTALL_STRING + " -runfromtemp -l";

RegDBGetItem(REGDB_UNINSTALL_LANGUAGE,strLanguage);
StrToNum(num,strLanguage);
Sprintf(strTemp,"0x%lX",num) ;

RegDBSetItem(REGDB_UNINSTALL_NOREPAIR,'1');
RegDBSetItem(REGDB_UNINSTALL_NOMODIFY,'1');

strUninstallCmdLine = strUninstallCmdLine + strTemp;
UNINST = strUninstallCmdLine + " -uninst";

AddFolderIcon( @ID_FOLDER_NAME, @ID_UNINSTALL, UNINST, DISK1TARGET,
"", 0, "", REPLACE );
end;
回复
hurryboylqs 2009-08-04
先反注册,然后delete file即可
回复
njlengjiang 2009-08-04
楼上的师兄能说的更详细点吗?

InstallScript中也使用了如下的代码进行反安装:
function OnFirstUIAfter()
STRING szfilename,szFolder ,szmsg1,szmsg2;
NUMBER nresult;
begin
//创建删除快捷方式
szfilename = UNINSTALL_STRING +" /UNINSTALL";
nresult = StrFind(szfilename,".exe");

if nresult >=0 then
StrSub(szmsg1,szfilename,0,nresult + 4);
StrSub(szmsg2,szfilename,nresult + 4,200);
LongPathToQuote(szmsg1, FALSE );
LongPathToQuote(szmsg2, FALSE );
szfilename = "\"" + szmsg1 + "\"" +szmsg2;
endif;
AddFolderIcon(FOLDER_PROGRAMS^"Test","Uninstall",szfilename,WINDIR,"",0,"",REPLACE);
End;

我在开始->程序->XXX->中添加了卸载的快捷方式,可以卸载但是卸载的不干净,会遗留下上面所说的那些文件。
楼上师兄的意思是指若ComponentRemoveAll()函数清理不完,则再使用DeleteFile()函数将安装路径下的文件清理掉??
回复
发动态
发帖子
VC/MFC
创建于2007-09-28

1.5w+

社区成员

VC/MFC相关问题讨论
申请成为版主
社区公告
暂无公告