LoadRTF: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
(Created page with "== Description == This header file allows you to easily load an RTF (Rich Text File) into a RichEdit20A/RichEdit20W control for use on, for example, custom pages. The header cor...") |
mNo edit summary |
||
Line 10: | Line 10: | ||
== Example == | == Example == | ||
Presuming you have two RTF files in the same folder as the script, test.rtf and test2.rtf ... | |||
<highlight-nsis> | <highlight-nsis> | ||
!addincludedir "." | !addincludedir "." |
Latest revision as of 18:42, 17 September 2010
Description
This header file allows you to easily load an RTF (Rich Text File) into a RichEdit20A/RichEdit20W control for use on, for example, custom pages. The header correctly handles use in multiple pages.
Attribution
This header file is the result of the forum discussion "RichEdit with nsDialogs?" ( http://forums.winamp.com/showthread.php?t=288129 ), and credit goes largely to Anders for the System calls required. The header file simply packages it up into easy-to-use functions and corrects the multiple-pages issue.
Header
- Main download link: LoadRTF.zip (1 KB).
MD5: b5d6f1a67cd08fca0ed214985cc06139 | Filesize: 1,279B
Example
Presuming you have two RTF files in the same folder as the script, test.rtf and test2.rtf ...
!addincludedir "." !include "nsDialogs.nsh" !include "LoadRTF.nsh" OutFile "$%temp%\temp.exe" Section SectionEnd Page Custom customPage Page Custom customPage2 Var dialog Var hwnd Var null Function customPage nsDialogs::Create 1018 Pop $dialog ${If} $dialog == error Abort ${EndIf} nsDialogs::CreateControl "RichEdit20A" \ ${ES_READONLY}|${WS_VISIBLE}|${WS_CHILD}|${WS_TABSTOP}|${WS_VSCROLL}|${ES_MULTILINE}|${ES_WANTRETURN} \ ${WS_EX_STATICEDGE} \ 0 0 100% 100% '' Pop $hwnd /* Load an RTF file into the control */ ${LoadRTF} "test.rtf" $hwnd nsDialogs::Show FunctionEnd Function customPage2 nsDialogs::Create 1018 Pop $dialog ${If} $dialog == error Abort ${EndIf} nsDialogs::CreateControl "RichEdit20A" \ ${ES_READONLY}|${WS_VISIBLE}|${WS_CHILD}|${WS_TABSTOP}|${WS_VSCROLL}|${ES_MULTILINE}|${ES_WANTRETURN} \ ${WS_EX_STATICEDGE} \ 0 0 100% 100% '' Pop $hwnd /* Load an RTF file into the control */ ${LoadRTF} "test2.rtf" $hwnd nsDialogs::Show FunctionEnd