InstallShield 打包实例 - 图文

// SetTitle( @PRODUCT_NAME, 0, BACKGROUNDCAPTION );

// SetColor(BACKGROUND,RGB (0, 128, 128));

// Enable( FULLWINDOWMODE ); // Enable( BACKGROUND );

Dlg_Start:

//---------------------------------------------------------------- //此处为第二次是卸载 svResult = SdLoadString(IFX_MAINTUI_MSG); szCaption = SdLoadString(IFX_ONMAINTUI_CAPTION); svResult=\是否要完全卸载“网上阅卷系统”?\ szCaption=\确认卸载\

nResult = SprintfBox(MB_OKCANCEL,szCaption,\ if (nResult = IDCANCEL) then exit;

elseif(nResult = IDOK) then // setup default status SetStatusWindow(0, \ Enable(STATUSEX);

StatusUpdate(ON, 100);

//-->Remove all components ComponentRemoveAll();

//------------------------------------------------------------------------------------------- //分离数据库EXEC sp_detach_db @dbname = '数据库名称'

//Server=[IS_SQLSERVER_SERVER];User

id=[IS_SQLSERVER_USERNAME];Pwd=[IS_SQLSERVER_PASSWORD];DataBase=wxd;Max Size=200;Connect Timeout=300;Connection Lifetime=3; //DetachDB(); //-----------------------------------------------------------------------------------------------------

//---------------------------------------------------------------------------- DeleteDir(TARGETDIR,ALLCONTENTS); DeleteDir(TARGETDIR,ONLYDIR);

//---------------------------------------------------------------------

endif; return 0;

//------------------------------------------------------------

// Added in Version 9.5 - Support for REMOVEONLY option. //新增的版本9.5 - 为REMOVEONLY选择支持

Pool

if( !REMOVEONLY ) then

// In standard mode show maintenance dialog //在标准模式对话框显示维修 Disable(BACKBUTTON); nType = SdWelcomeMaint(szTitle, szMsg, MODIFY);

Enable(BACKBUTTON); else

// Hide the initial progress dialog as otherwise the user can // click on it, and hide the MessageBox.

//隐藏,否则用户的对话,可以初步进展点击它,并隐藏在MessageBox。 Disable( DIALOGCACHE );

// In RemoveOnly mode, set to remove. //在RemoveOnly模式,设置删除 nType = REMOVEALL; endif;

// Show Uninstall Confirmation Dialog //显示卸载确认对话框

if ( nType = REMOVEALL ) then nResult = MessageBox( SdLoadString( IFX_MAINTUI_MSG ), MB_YESNO ); if (nResult != IDYES ) then

if( REMOVEONLY ) then

// In REMOVEONLY mode, abort the setup. //显示卸载确认对话框 abort;

else

// In non-REMOVEONLY mode, redisplay the previous dialog. //在非REMOVEONLY模式,重新显示以前的对话。 goto Dlg_Start; endif;

endif;

endif;

nResult = NEXT;

Dlg_SdFeatureTree:

if (nType = MODIFY) then szTitle = \

szMsg = \

nResult = SdFeatureTree(szTitle, szMsg, INSTALLDIR, \if (nResult = BACK) goto Dlg_Start;

endif;

switch(nType) case REMOVEALL: FeatureRemoveAll(); case REPAIR: FeatureReinstall();

endswitch;

// setup default status //设置默认状态

SetStatusWindow(0, \Enable(STATUSEX); StatusUpdate(ON, 100);

end;

//--------------------------------------------------------------------------- // OnUninstall //

// The OnUninstall event is called when the setup is run with the -uninst // switch, in this case this is the only event that will be called.

//该OnUninstall活动名为安装程序时,使用- uninst运行开关,在这种情况下,这是唯一的事件,将被调用。

//---------------------------------------------------------------------------

function OnUninstall() BOOL bvOpt1, bvOpt2; string szTitle, szMsg1, szMsg2, szOpt1, szOpt2, svResult, szCaption; begin

//标题设置

SetTitle(\欢迎您使用银河卡电子产品\ 24, WHITE);

//------------------------------------------------------- // 在桌面上删除快捷方式

DeleteFolderIcon (FOLDER_DESKTOP, TARGETDIR+\ //删除程序中的快捷方式

GF

DeleteFolderIcon(FOLDER_PROGRAMS^\\

//------------------

svResult = SdLoadString(ISWI_IS5_UNINST_MSG); szCaption = SdLoadString(IFX_ONMAINTUI_CAPTION);

Sprintf (svResult, svResult, @PRODUCT_NAME);

if (IDCANCEL = SprintfBox(MB_OKCANCEL, szCaption, svResult)) then abort; endif;

Enable(STATUSEX);

////////////////////////////////////// //DO NOT DELETE. The below code will //initiate the uninstallation process. ComponentRemoveAll();

ComponentTransferData(MEDIA); //////////////////////////////////////

Disable(STATUSEX); bvOpt1 = FALSE; bvOpt2 = FALSE;

szMsg1 = SdLoadString(IFX_SDFINISH_MAINT_MSG1);

szTitle = SdLoadString(IFX_SDFINISH_MAINT_TITLE);

SdFinishEx(szTitle, szMsg1, szMsg2, szOpt1, szOpt2, bvOpt1, bvOpt2); //删除安装文件

DeleteDir(ProgramFilesFolder+\

Installation Installation

Information\\\\{E71A5501-0CCF-4765-A743-8F1352781170}\ DeleteDir(ProgramFilesFolder+\

Information\\\\{E71A5501-0CCF-4765-A743-8F1352781170}\ end;

/////////////////////////////////////////////////////////////////////// prototype AttachDB(STRING,STRING,STRING);

function number AttachDB(svSQLsvr,svSQLusr,svSQLpwd) STRING szCmdLine,szWaitTxt; begin szWaitTxt=\正在附加所需数据库??\ SdShowMsg (szWaitTxt, TRUE);

Delay(2); if(bWinLogin) then

szCmdLine = \/E /S \/Q \\\ sp_attach_db @dbname = N'YCSCMDB',@filename1 = N'\示例数据库\\\\YCSCMDB_Data.MDF',@filename2 = N'\示例数据库\\\\YCSCMDB_Log.LDF'\\\

WriteDBInfo(\ /S \

else

szCmdLine = \ sp_attach_db

@dbname = N'YCSCMDB',@filename1 = N'\示例数据库\\\\YCSCMDB_Data.MDF',@filename2 = N'\示例数据库\\\\YCSCMDB_Log.LDF'\\\ WriteDBInfo(\ endif;

//szCmdLine = \\/P \/S \/Q \\\

N'\

sp_attach_db @dbname = N'dlbj',@filename1 = ^\ = N'\ if (LaunchAppAndWait(\

MessageBox (\数据库附加失败!数据库文件已安装到本地目录,请手动附加!\ endif;

SdShowMsg (szWaitTxt, FALSE);

//szWaitTxt=\正在优化系统数据库??\ //SdShowMsg (szWaitTxt, TRUE); //Delay(2);

//szCmdLine = \\/P \/S \/Q \\\dlbj ; exec

sp_updatestats\\\

// if (LaunchAppAndWait(\

// MessageBox (\数据库优化失败!您可以在 sql查询分析器中执行 use dlbj ; exec sp_updatestats 完成!\ // endif;

// SdShowMsg (szWaitTxt, FALSE);

return 0;

end;

//--------------------------------------------------------------------------- // OnEnd //

// The OnEnd event is called at the end of the setup. This event is not // called if the setup is aborted.

//--------------------------------------------------------------------------- function OnEnd() begin end;

//--------------------------------------------------------------------------- // OnAppSearch

//

// The OnAppSearch event is called after OnBegin and can be used to search // for previous versions of the current application. This event is called // only when the setup is running in first install mode. //--------------------------------------------------------------------------- function OnAppSearch() begin

end;

//--------------------------------------------------------------------------- // OnBegin

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4