InstallShield basic ways to create a custom dialog box

Source: Internet
Author: User
Tags goto

InstallShield's InstallScript Project

1. In Dialogs view, right-click All Dialog, select New dialog box (new Dialog)
2. Create a blank dialog box named Mydlg.
3. Double-click the subkey under Mydlg to enter the edit mode of the dialog box
4. Here we add a Hello button. Select the button control and then drag a button control on the interface of the dialog box.
Modify Button property text is hello. Notice the control identifer attribute value here, which we'll use later.

5. Create a new Rul file in the InstallScript view, named Mydlg.url
6. Preparation of Mydlg.url
The contents are as follows:
#define DLG_MYDLG "Mydlg"//mydlg is our dialog box name.
#define HELLOBTN 1301//1301 is the control Identifer property value of our button.

Prototype number Mydlg (BYREF STRING);

function number Mydlg (msg)
HWND Hdlg;
Number NId, Nresult;
Number Ncontrol;
BOOL Bdone;
Begin
Initial dialog box function
if (Ezdefinedialog (Dlg_mydlg,isuser, "Mydlg", 0) = Dlg_err) Then
return iserr_gen_failure;
endif

Bdone = FALSE;
Cycle
while (!bdone)
NId = Waitondialog (DLG_MYDLG); Get a message for a dialog box
Switch (NID)
Case HELLOBTN://If it is 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 content:
Added is #include "Mydlg.rul"
And our custom dialog box. The rest of the code is automatically generated.
The Install UI sequence-before move Data
//
The Onfirstuibefore event is called by Onshowui when the "Setup is"
Running in the install mode. By default this event displays UI allowing
The end user to specify installation parameters.
//
Note:this event won't is 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:
Our custom dialog box
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, SZOPT1, SzOpt2, 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, szmsg, 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, szmsg, "", 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, Sztargetpath, 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, szmsg, 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, szmsg, 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

Compile and run to see your own side box.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.