Search code examples
rtfinstallshield-2011installscript-msi

How to read data from RTF file & write it to ScrollableText at the time of installation?


I'm having InstallScript MSI project built in InstallShield. I''m having Custom License Dialog in my installer. I want to read data from license RTF file and write it to ScrollableText control using InstallScript. How can I achieve this?

Also Is there any way to set FileName of ScrollableText control at installation time using InstallScript?

At installation time, I tried to read all data from RTF file to LIST using InstallScript function ListReadFromFile() and tried to write that data to ScrollableText using function CtrlSetMLEText(). But ScrollableText is not showing all data of RTF file.

So can someone please suggest me any another way to achieve this ?


Solution

  • ScrollableText control was truncating the data is because it can only show data up to specific character count (32xxx).
    To solve this, I have changed the limit of ScrollableText before sending data to it. Using the following code we can set the character limit for the edit box.

    // Get dialog handle
    hDlg = CmdGetHwndDlg(SD_DLG_LICENSE_RTF);
    
    // Get Control handle
    hScrollControl = CtrlGetDlgItem(SD_DLG_LICENSE_RTF, hDlg, 301);
    
    SendMessage(hScrollControl, EM_LIMITTEXT, 40000, 0);  
    

    Using EM_LIMITTEXT or EM_EXLIMITTEXT, we can set a limit for edit fields.
    Here is a related article on MSDN blog for this scenario.