InstallShield创建自定义对话框的基本方法
发布时间:2020-12-12 15:49:41 所属栏目:MsSql教程 来源:网络整理
导读:Installshield的InstallScript项目 1.在Dialogs视图中,右键All Dialog,选择新建对话框(New Dialog) 2.创建一个空白对话框,命名为MyDlg. 3.双击MyDlg下的子项即可进入对话框的编辑模式 4.这里我们添加一个Hello按钮。选择按钮控件然后在对话框的界面上拖
Installshield的InstallScript项目 1.在Dialogs视图中,右键All Dialog,选择新建对话框(New Dialog) 2.创建一个空白对话框,命名为MyDlg. 3.双击MyDlg下的子项即可进入对话框的编辑模式 4.这里我们添加一个Hello按钮。选择按钮控件然后在对话框的界面上拖拉出一个按钮控件。 ??? 修改按钮属性text为Hello。注意一下这里的Control Identifer属性值,后面我们会用到。 5.在installscript视图中新建一个rul文件,命名为MyDlg.url 6.编写MyDlg.url 内容如下: #define DLG_MYDLG "MyDlg" //MyDlg是我们的对话框名字 #define HELLOBTN 1301 //1301就是我们那个按钮的Control Identifer属性值 prototype NUMBER MyDlg(BYREF STRING); function NUMBER MyDlg(msg) ???? HWND??? hDlg;????? ???? NUMBER nId,nResult; ??? NUMBER nControl; ??? BOOL bDone; begin ??? //初始对话框函数 ???? if (EzDefineDialog( DLG_MYDLG,ISUSER,"MyDlg",0 ) = DLG_ERR) then??? ???? ???? return ISERR_GEN_FAILURE; ??? endif;??? ??? ?? ??? bDone = FALSE; ??? //循环 ??? while (!bDone) ??? ??? nId = WaitOnDialog( DLG_MYDLG ); //获得对话框的消息 ?? ??? ??? switch (nId) ??? ??? ??? case HELLOBTN:????? //如果是HELLOBTN ??? ??? ??? MessageBox(msg,WARNING); ??? ??? ??? bDone=TRUE;??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? case DLG_ERR:??? ??? ??? ??? ??? nId?? = ISERR_GEN_FAILURE; ??????????? SdError(nId,DLG_MYDLG); ??????????? bDone = TRUE;??? ??????????? ??????? case DLG_CLOSE:????????? ??? ??? ??? ??? SdCloseDlg(hDlg,nId,bDone);?? ??? ??? ??? ??????? default: ??????????? // check standard handling ??????????? if (SdIsStdButton(nId) && SdDoStdButton(nId)) then ??????????? ??? bDone = TRUE; ??????????? endif; ??????????????? ??? ??? ??? ??? ??? ??? ??? ??? ??? endswitch; ??? endwhile; end; 7.setup.url内容: //添加的内容是 #include "MyDlg.rul" //以及我们自定义的对话框。其他的代码都是自动生成的。 // First Install UI Sequence - Before Move Data // // The OnFirstUIBefore event is called by OnShowUI when the setup is // running in first install mode. By default this event displays UI allowing // the end user to specify installation parameters. // // Note: This event will not be called automatically in a // program...endprogram style setup. //--------------------------------------------------------------------------- #include "MyDlg.rul" function OnFirstUIBefore() ??? number nResult,nLevel,nSize,nSetupType; ??? string szTitle,szMsg,szOpt1,szOpt2,szLicenseFile; ??? string szName,szCompany,szTargetPath,szDir,szFeatures; ??? BOOL??? bLicenseAccepted;??? begin??? ?? ??? nSetupType = COMPLETE;??? ??? szDir = TARGETDIR; ??? szName = ""; ??? szCompany = ""; ??? bLicenseAccepted = FALSE; // Beginning of UI Sequence Dlg_Start: ??? nResult = 0; Dlg_SdWelcome: ??? szTitle = ""; ??? szMsg = ""; ??? //{{IS_SCRIPT_TAG(Dlg_SdWelcome) ??? nResult = SdWelcome( szTitle,szMsg ); ??? //}}IS_SCRIPT_TAG(Dlg_SdWelcome) ??? if (nResult = BACK) goto Dlg_Start; Dlg_Hello: ////我们自定义的对话框 ??? szTitle="";??? ??? szMsg="It's my hello DLG"; ??? nResult=MyDlg(szMsg); ??? if (nResult=BACK) goto Dlg_Start; Dlg_SdLicense2: ??? szTitle = ""; ??? szOpt1 = ""; ??? szOpt2 = ""; ??? //{{IS_SCRIPT_TAG(License_File_Path) ??? szLicenseFile = SUPPORTDIR ^ "License.rtf"; ??? //}}IS_SCRIPT_TAG(License_File_Path) ??? //{{IS_SCRIPT_TAG(Dlg_SdLicense2) ??? nResult = SdLicense2Rtf( szTitle,szLicenseFile,bLicenseAccepted ); ??? //}}IS_SCRIPT_TAG(Dlg_SdLicense2) ??? if (nResult = BACK) then ??????? goto Dlg_SdWelcome; ??? else ??????? bLicenseAccepted = TRUE; ??? endif;???? ??? Dlg_SdRegisterUser: ??? szMsg = ""; ??? szTitle = ""; ??? //{{IS_SCRIPT_TAG(Dlg_SdRegisterUser)??? ?? // nResult = SdRegisterUser( szTitle,szName,szCompany ); ??? //}}IS_SCRIPT_TAG(Dlg_SdRegisterUser) ??? if (nResult = BACK) goto Dlg_MyDlg; Dlg_SetupType2:?? ??? szTitle = ""; ??? szMsg = ""; ??? nResult = CUSTOM; ??? //{{IS_SCRIPT_TAG(Dlg_SetupType2)??? ?? // nResult = SetupType2( szTitle,"",nSetupType,0 ); ??? //}}IS_SCRIPT_TAG(Dlg_SetupType2) ??? if (nResult = BACK) then ??????? goto Dlg_SdRegisterUser; ??? else ??????? nSetupType = nResult; ??????? if (nSetupType != CUSTOM) then ??????????? szTargetPath = TARGETDIR; ??????????? nSize = 0; ??????????? FeatureCompareSizeRequired( MEDIA,nSize ); ??????????? if (nSize != 0) then????? ??????????????? MessageBox( szSdStr_NotEnoughSpace,WARNING ); ??????????????? goto Dlg_SetupType2; ??????????? endif; ??????? endif;?? ??? endif; Dlg_SdAskDestPath2: ??? if ((nResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SetupType2; ??? szTitle = ""; ??? szMsg = ""; ??? if (nSetupType = CUSTOM) then ??????????????? //{{IS_SCRIPT_TAG(Dlg_SdAskDestPath2)??? ??? ??? nResult = SdAskDestPath2( szTitle,szDir ); ??????????????? //}}IS_SCRIPT_TAG(Dlg_SdAskDestPath2) ??????? TARGETDIR = szDir; ??? endif; ??? if (nResult = BACK) goto Dlg_SetupType2; Dlg_SdFeatureTree: ??? if ((nResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SdAskDestPath2; ??? szTitle = ""; ??? szMsg = ""; ??? szFeatures = ""; ??? nLevel = 2; ??? if (nSetupType = CUSTOM) then ??????? //{{IS_SCRIPT_TAG(Dlg_SdFeatureTree)??? ?????? // nResult = SdFeatureTree( szTitle,TARGETDIR,szFeatures,nLevel ); ??????? //}}IS_SCRIPT_TAG(Dlg_SdFeatureTree) ??????? if (nResult = BACK) goto Dlg_SdAskDestPath2; ??? endif; Dlg_SQLServer: ??? nResult = OnSQLServerInitialize( nResult ); ??? if( nResult = BACK ) goto Dlg_SdFeatureTree; Dlg_ObjDialogs: ??? nResult = ShowObjWizardPages( nResult ); ??? if (nResult = BACK) goto Dlg_SQLServer; ??? Dlg_SdStartCopy2: ??? szTitle = ""; ??? szMsg = ""; ??? //{{IS_SCRIPT_TAG(Dlg_SdStartCopy2)??? ??? nResult = SdStartCopy2( szTitle,szMsg );??? ??? //}}IS_SCRIPT_TAG(Dlg_SdStartCopy2) ??? if (nResult = BACK) goto Dlg_ObjDialogs; ??? // Added in 11.0 - Set appropriate StatusEx static text. ??? SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_FIRSTUI ) ); ??? return 0; end; 编译运行就可以看到自己的对方框了。
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- SQLSERVER存储过程的基本语法实例
- sql-server – SQL Server是否保证顺序插入一个标识列?
- SQLServer 2005 海量数据解决方案 分区表
- 工作中遇到sqlserver2008表跟表之间的数据备份,老容易忘记
- SQLServer中给表增加组合唯一约束
- MSSQL自动重建出现碎片的索引的方法分享
- 如何在SQL Server Compact Edition中重命名表?
- sql-server – 如何在恢复中停止,脱机和删除SQL Server数据
- sql-server – 重新打开SQL Server Management Studio后还原
- SQLServer2008设置开启INTERNET远程连接