MAKEMSI quickly and reliably creates MSI files in a non-programmatic way
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
[Bottom][Contents][Prev]: Browse for File Dialog (in DLL Custom Action)[Next]: Add Dialog Identification To Titlebar
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Tips and Tricks->User Interface Tips->Control Removal

Control Removal #1

This is a User Interface Tips example to demonstrate how MAKEMSI can may "on the fly" changes to a standard template allowing you to accept templates from other people.

Generally I don't need the CD-KEY information that the "UserRegistrationDlg" normally requests.

What I did was create 2 identical msi files called "b.msi" (before) and "a.msi" (after). I then used "ORCA" to modify the "Control" table (of "a.msi") and used ORCA's preview dialog mode until I was happy with its look - and I'd stopped getting error messages :-)

Once I was happy with "a.msi" I used the following command to execute MsiDiff.VBS:

msidiff b.msi a.msi > diff.txt

The above command generated (diff.txt):

[]--------------------------------------------------------------[]
| MSIDIFF.VBS v03.073: Dumps MSI differences in "MakeMsi" format |
|           (C)opyright Dennis Bareis 2003. All rights reserved. |
|                            http://dennisbareis.id,au/index.htm |
[]--------------------------------------------------------------[]

<$Msi 'a.msi' Template='b.msi'>

<$Table "Control">
    <$RowsDelete WHERE="Dialog_ = 'UserRegistrationDlg' AND Control = 'CDKeyLabel'">
    <$RowsDelete WHERE="Dialog_ = 'UserRegistrationDlg' AND Control = 'CDKeyEdit'">
    #(
        <$Row @Where="Dialog_ = 'UserRegistrationDlg' AND Control = 'OrganizationEdit'" @OK='=1'
            Control_Next="Back"      ;;Previous value = CDKeyLabel
        >
    #)
<$/Table>

<$Summary   "LastAuthor"  Value="Dennis">      ;;Previous value = Dennis Bareis
<$Summary "LastSave_DTM"  Value="4/05/03 5:52:40 PM">

<$/Msi>

The "summary" information changes have nothing to do with the dialog changes and so can be ignored. So basically the code between the "Table" and "/Table" commands is what we need.

Control Removal #2

The following demonstrates some VBSCRIPT imbedding as well as how records can be examined.

The "Typical" setup button on simpler MSI files may not be any different to the "Complete" button so as not to confuse the user we will disable the button if this appears to be the case or the developer insists:

#( ''
   #define DisableTypicalSetupButtonIfRequired

   ;--- Decide if we need the typical button --------------------------------
   dim DisableTypicalButton : DisableTypicalButton = true<?NewLine>
   #if ['<$UISAMPLE_DISABLE_TYPICAL_SETUP>' = 'S']
       ;--- May want to disable it... ---------------------------------------
       <$Table "Feature">
           #(
               <$Row
                   @WHERE=^<$UISAMPLE_DISABLE_TYPICAL_SETUP_IF_LEVEL>^
                   @Code="Y"
               >
           #)
               ;--- At least one feature that is deselected by default ----------
               DisableTypicalButton = false
           <$/Row>
       <$/Table>
   #endif

   ;--- Disable the button? -------------------------------------------------
   if  DisableTypicalButton then<?NewLine>
       ;--- Disable the "Typical" control (its the same as "Complete") ------
       <$Table "Control">
           ;--- Hide the "Typical" controls ---------------------------------
           #(
               <$Row    @Where="Dialog_ = 'SetupTypeDlg' AND Control = 'TypicalLabel'"
                           @OK=^? = 1^
                   *Attributes=^0^
               >
           #)
           #(
               <$Row    @Where="Dialog_ = 'SetupTypeDlg' AND Control = 'TypicalButton'"
                           @OK=^? = 1^
                   *Attributes=^0^
               >
           #)
           #(
               <$Row    @Where="Dialog_ = 'SetupTypeDlg' AND Control = 'TypicalText'"
                           @OK=^? = 1^
                   *Attributes=^0^
               >
           #)

           ;--- Move the "Custom" button up a bit to make it look better ----
           #(
               <$Row @Where="Dialog_ = 'SetupTypeDlg' AND Control = 'CustomButton'"
                   @OK='=1'
                     Y="70"      ;;Previous value = 118
               >
           #)
           #(
               <$Row @Where="Dialog_ = 'SetupTypeDlg' AND Control = 'CustomLabel'"
                   @OK='=1'
                     Y="70"      ;;Previous value = 118
               >
           #)
           #(
               <$Row @Where="Dialog_ = 'SetupTypeDlg' AND Control = 'CustomText'"
                   @OK='=1'
                     Y="83"      ;;Previous value = 131
               >
           #)

           ;--- Tweek the "Complete" button ---------------------------------
           #define? UISAMPLE_TWEEKED_COMPLETE_BUTTON_LABEL &Install
           #define? UISAMPLE_TWEEKED_COMPLETE_BUTTON_TEXT  Install the complete product in the default location.
           #(
               <$Row @Where="Dialog_ = 'SetupTypeDlg' AND Control = 'CompleteLabel'"
                        @OK='=1'
                       Text="[DlgTitleFont]<$UISAMPLE_TWEEKED_COMPLETE_BUTTON_LABEL>"
               >
           #)
           #(
               <$Row @Where="Dialog_ = 'SetupTypeDlg' AND Control = 'CompleteText'"
                        @OK='=1'
                       Text="<$UISAMPLE_TWEEKED_COMPLETE_BUTTON_TEXT>"
               >
           #)
       <$/Table>
   end if
#)
#define? UISAMPLE_DISABLE_TYPICAL_SETUP   S           ;;User A=Always, S=Sometimes or N=Never
#if    ['<$UISAMPLE_DISABLE_TYPICAL_SETUP>' <> 'N']
   ;--- (either "A" or "S") Disable button if any features have a level > 3 -
   #define? UISAMPLE_DISABLE_TYPICAL_SETUP_IF_LEVEL `Level` > 3  ;;Any matches mean that "Typical" <> "Complete"
   ;#OnExit #51 <$DisableTypicalSetupButtonIfRequired>
   <$DisableTypicalSetupButtonIfRequired>
#endif


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: Browse for File Dialog (in DLL Custom Action)[Next]: Add Dialog Identification To Titlebar


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Friday October 13 2017 at 2:08pm
Visit MAKEMSI's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.