InstallShield 打包实例 - 图文 下载本文

内容发布更新时间 : 2024/11/15 23:17:59星期一 下面是文章的全部内容请认真阅读。

//---------------------------------------------------------------- //此处为第二次是卸载

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选择支持 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

Pool

// 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+\ //删除程序中的快捷方式

DeleteFolderIcon(FOLDER_PROGRAMS^\网上阅卷系统GF\ //------------------

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+\

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 \\\ sp_attach_db @dbname = N'dlbj',@filename1 = N'\^\ = N'\

if (LaunchAppAndWait(\

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

SdShowMsg (szWaitTxt, FALSE);

=

Installation Installation

//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 //

// The OnBegin event is called directly by the framework after the setup // initializes.

//--------------------------------------------------------------------------- function OnBegin()

begin

// TO DO: you may change default non-UI setting, for example //