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]: Progress Bar - Move Bar[Next]: Remote Desktop Shortcuts
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->Read Me dialogs (rtf formatted text in scrollable control)

Read Me dialogs (rtf formatted text in scrollable control)

You can put this code into a common header file and then define the name of the file containing the readme in the macro "READMEDLG_TEXT_FILE":

;--- Does the user want a readme dialog (if so they have told us the filename)? ---
#ifdef  READMEDLG_TEXT_FILE
    ;--- Define the version number of this tip ------------------------------
    #define READMEDLG_VERSION           10.116

    ;--- Define some defaults -----------------------------------------------
    #define? READMEDLG_TEXT_TITLE       Read Me
    #define? READMEDLG_TEXT_DESCRIPTION Some important information, please read it before continuing...
    #ifndef  READMEDLG_INSERT
        ;--- User hasn't defined the "Dialog" commands "INSERT" parameter ---
        #ifdef REMOVED_LicenseAgreementDlg           ;;Only exists if the dialog has been removed...
               #define? READMEDLG_INSERT WelcomeDlg
        #else
               #define? READMEDLG_INSERT LicenseAgreementDlg
        #endif
    #endif

    ;--- User has specified the name of a readme file so read it into a vbscript string format ---
    #DefineRexx ''
       ;--- Make sure the licence file exists -------------------------------
       @@ReadMeFile = FindFile("<$READMEDLG_TEXT_FILE>")
       if  @@ReadMeFile = '' then
           Error('We could not find the readme file "<$READMEDLG_TEXT_FILE>"');

       ;--- Read the information --------------------------------------------
       call FileClose @@ReadMeFile, 'N';
       @@Text = charin(@@ReadMeFile,1, 999999);
       call FileClose @@ReadMeFile;

       ;--- Create a VB string (including the outer quotes) -----------------
       @@VbStr = ReplaceString(@@Text,  '"',   '""');
       @@VbStr = ReplaceString(@@VbStr, '00'x, ' ');      ;;God knows why the trailing null exists...
       @@VbStr = ReplaceString(@@VbStr, '0D'x, '" & vbCR & "');
       @@VbStr = ReplaceString(@@VbStr, '0A'x, '" & vbLF & "');
       @@VbStr = '"' || @@VbStr || '"'                    ;;Add the outer quotes
    #DefineRexx

    ;--- Create an empty dialog at configured location (but with normal buttons etc) ---
    <$Dialog "<$READMEDLG_TEXT_TITLE>" Description="<$READMEDLG_TEXT_DESCRIPTION>" INSERT="<$READMEDLG_INSERT>" Dialog="ReadMeDlg">
    <$/Dialog>

    ;--- Now insert out controls by "hand" (can cheat by copying from other dialogs) ---
    <$Table "Control">
        ;--- Add the readme control ---------------------------------------------
        #(
           <$Row
                    Dialog_="ReadMeDlg"
                    Control="ReadMeRtfText"
                       Type="ScrollableText"
                          X="20"
                          Y="60"
                      Width="330"
                     Height="120"
                 Attributes="7"
                   Property=""
                      *Text=^<??@@VbStr>^           ;;Use the VBSCRIPT string we created above
               Control_Next="Back"                  ;;Finish the control chain ("BannerBitmap" points there now, fixed below)
                       Help=""
           >
        #)

        ;--------------------------------------------------------------------------
        ;--- The "ReadMeDlg" started "empty" so "BannerBitmap" points to "Back" ---
        ;---     * We will need to point it to our first control                ---
        ;---     * Our last control needs to point to "Back"                    ---
        ;--------------------------------------------------------------------------
        #(
             <$Row
                     @Where="`Dialog_` = 'ReadMeDlg' AND `Control` = 'BannerBitmap'"
                        @OK='=1'
               Control_Next="ReadMeRtfText"      ;;Previous value = Back, this points to the first control we add to the empty dialog
           >
        #)
    <$/Table>
#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]: Progress Bar - Move Bar[Next]: Remote Desktop Shortcuts


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Sunday February 28 2016 at 3:45pm
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.