Results 1 to 4 of 4

Thread: How to display custom dialog bozes in InstallScript MSI Projects

  1. #1
    Join Date
    Feb 2005
    Posts
    99

    How to display custom dialog bozes in InstallScript MSI Projects

    Hi,

    One has to use ExDefineDialog and WaitOnDialog to display a custom dialog boxes. These functions use soemthign called DialogId to display the existing dialogues in the InstallShield software. How to find out the dialog IDs for the custom dialogs. Let me know if there is another way.

    Thx,
    Vivek.

  2. #2
    Join Date
    Oct 2001
    Location
    Here and there
    Posts
    16,243
    In the third argument to EzDefineDialog, you can pass the name of the dialog appearing in the Dialogs view as a string: if the dialog is called MyCustomDialog in the Dialogs view, use "MyCustomDialog" in EzDefineDialog...

  3. #3
    Join Date
    Jan 2005
    Posts
    43
    If you go into the direct editor and then to the dialog section you will find your custom dialog name. Scroll all the way to the rightmost column and you will see the dialog ID's that have been assigned. Find one that is unused and enter it in the column.

  4. #4
    Join Date
    Jul 2003
    Location
    North Kingstown, RI, USA
    Posts
    948
    Here is the process I take for handling Custom Dialog boxes
    1. Switch to Dialog under User Interface
    2. Create your custom dialog box with all its controls the way you need it.
    3. Swtich to direct editor and select the Dialog table.
    4. When you created your dialog you could specify the name you want for the dialog. That name should appear in this table.
    5. Find that name and then scroll all the way to the right. The very last column contains the ID.
    6. It seems that the default for this ID is 0 (unless I am doing something wrong). Change it to a number that does not conflict with existing dialogs. I usually use numbers in the 13000 range. What value you specify here you have to now define in your script.

    Here is how I handle defining my dialogs.
    1. Create a CustomDialogs.h file (the name does not matter).
    2. In this .h file create prototypes and defines for each dialog and their controls.

    Code:
    prototype License();
    prototype AbbrevLicense();
    prototype NUMBER FrameWorkRegDlg();
    prototype NUMBER PhoneRegDlg();
    ...
    //define dialog IDs
    #define RES_DIALOG_ID                                      13051  
    #define RES_DIALOG_PRODUCT_UNINSTALL		13071
    #define REGISTRATION_DLG_ID		               13034
    #define LICENSE_DIALOG_ID       	                 13035
    
    //define controls for dialogs
    //Control IDs
    	#define RADIO1		1000
    	#define RADIO2		1005
    	#define RADIO3		1010
       
      	#define CHECKBOX1     1100
    	#define CHECKBOX2     1105
    	#define CHECKBOX3     1110
    
    	#define TEXT1		3000
    	#define TEXT2		3005
    	#define TEXT3		3010
    
    	#define COMBO1		7000
    	#define COMBO2		7005
    3. Create a CustomDialogs.rul file (name does not matter) and define your functions.
    Code:
    ///////////////////////////////////////////////////////////////////////////////
    //
    // Function: DriverInstall
    // Purpose: Custom Dialog requiring user to choose from 2 radio buttons. Large
    //				text description boxes above and below radio buttons.
    //
    ///////////////////////////////////////////////////////////////////////////////
    function DriverInstall(sMsg, sRadioOne, sRadioTwo)
    	STRING szDialogName;
    	HWND hDlg;
    	BOOL bBasicOnly;
    	NUMBER nReturn;
    begin
    
       // Specify a name to identify the custom dialog in this setup.
       szDialogName = "CustomDialog";
    
       // Define the dialog.  Pass a null string in the second parameter
       // to get the dialog from _isuser.dll or _isres.dll.  Pass a null
       // string in the third parameter because the dialog is identified
       // by its ID in the fourth parameter.
       nResult = EzDefineDialog(szDialogName, "", "", TEXT2_RADIO2);
    
       if (nResult < 0) then
         // Report an error; then terminate.
          MessageBox ("Error in defining dialog", SEVERE);
          abort;
       endif;
    
       // Initialize the indicator used to control the while loop.
       bDone = FALSE;
    
       // Loop until done.
       repeat
    
     	  // Display the dialog and return the next dialog event.
          nCmdValue = WaitOnDialog(szDialogName);
    
      	  // Respond to the event.
          switch (nCmdValue)
    
             case 2, DLG_CLOSE:
                Do(EXIT); // The user clicked the window's close button.
    			
             case DLG_ERR:
                MessageBox ("Dialog failed.", SEVERE);
                bDone = TRUE;
    
             case DLG_INIT: ;
                // No initialization is required for this example.
    				CtrlSetState(szDialogName, RADIO1, BUTTON_CHECKED);
    				CtrlSetText(szDialogName, TEXT1, sMsg);
    				CtrlSetText(szDialogName, TEXT2, "");		//Second text box is not used, so set it to empty string.
    				CtrlSetText(szDialogName, RADIO1, sRadioOne);
    				CtrlSetText(szDialogName, RADIO2, sRadioTwo);
    
    				hDlg = CmdGetHwndDlg(szDialogName);				
    				SetWindowText(hDlg, "Driver Option");		// Set the window title. Defined in Winsub.rul.  
    			
             case SD_PBUT_CONTINUE:
    				if (CtrlGetState(szDialogName, RADIO1) = BUTTON_CHECKED) then
    					bInstDriver = FALSE;
    				elseif (CtrlGetState(szDialogName, RADIO2) = BUTTON_CHECKED) then
    					bInstDriver = TRUE;
    				endif;
    				
    				bDone = TRUE;
    				
    	      case SD_PBUT_EXITSETUP:				//Cancel button
    	            Do(EXIT);
    	            bDone=TRUE;
    	
    	      case SD_PBUT_BACK:
    	            EndDialog(szDialogName);		// Close the dialog box.
    					ReleaseDialog(szDialogName);	// Free the dialog box from memory.
    	         	return BACK;
    			
    			case SD_PBUT_CANCEL:       //Esc key
    					Do(EXIT);
    
          endswitch;
    
       until bDone;
    
    
       // Close the dialog box.
       EndDialog(szDialogName);
       // Free the dialog box from memory.
       ReleaseDialog(szDialogName);
       
    end;
    Regards,
    Dan Lee

    Release Engineer

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •