Archive: nsRichEdit plug-in


nsRichEdit plug-in
* Load a file into a rich edit control (using EM_STREAMIN).
* Provides formatted printing of a rich edit control.
* Allows oneself to add a print button to the NSIS license pages.

http://nsis.sourceforge.net/File:NsRichEdit.zip

Note to JasonFriday13 for CustomLicense plug-in: There are a number of errors in your code (which is one reason why I added my own function to this plug-in).

29: Should be TCHAR* FileName.
42: !FileHandle is not a valid test for an invalid handle (only use INVALID_HANDLE_VALUE).
46, 56, 60: You're not closing the file handle.
87, 88: The amount of memory to allocate should be sizeof(TCHAR) * string_size (because Unicode characters are 2 bytes).
105: You are casting the return value from GetLastError to (const TCHAR*) and pushing it onto the stack. This will (in most cases) cause a crash. To convert an integer to a string, use wsprintf. Besides, I'm not sure why you are using GetLastError because GlobalAlloc does not set it.

I'd recommend using EM_STREAMIN too as right now you are reading the entire license file into memory before setting it.

Stu


Nice, your control replaces original License rich edit or it is only on new page [nsDialogs]?


It can be used for any existing rich edit control as all it needs is a control handle (it does not create the control itself). It can be one you've added to a nsDialogs page or the existing license page rich edit control (use AddPrintButton for this). The example scripts demonstrate all functions.

Stu


Cool, well it's nice to know a better piece of software has come up. My code was written way back when I was first understanding coding in C (initially to fix one of my installer problems). Some of the errors are obvious while others aren't. In fact, it's probably not worth keeping it on the wiki anymore as your plugin is clearly superior.


I have made a note on the wiki page.

Stu