Rich Edit Control in raw Win32

Is the documentation for Rich Edit Controls really bad (wrong?) As it seems? Right now, I manually call LoadLibrary ("riched20.dll") to display Rich Edit Control. The documentation for Rich Edit poorly demonstrates this in the first code example for using Rich Edit controls.

He talks about calling InitCommonControlsEx () to add visual styles, but doesn't mention which flags will pass.

Is there a better way to load a Rich Edit control?

http://msdn.microsoft.com/en-us/library/bb787877(VS.85).aspx

Here is the only code I could write to make it work:

#include "Richedit.h"
#include "commctrl.h"

INITCOMMONCONTROLSEX icex;
icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
icex.dwICC = ICC_USEREX_CLASSES;  //Could be 0xFFFFFFFF and it still wouldn't work
InitCommonControlsEx(&icex);  //Does nothing for Rich Edit controls

LoadLibrary("riched20.dll");  //Manually?  For real?
hWndRichEdit = CreateWindowEx(
    ES_SUNKEN,
    RICHEDIT_CLASS,
    "",
    WS_BORDER | WS_VISIBLE | WS_CHILD,
    2, 2, 100, 24,
    hWnd, (HMENU) ID_RICH_EDIT, hInst, NULL);
+3
source share
4 answers

MFC, RichEdit .

InitCommonControlsEx() - ICC_USEREX_CLASSES RichEdit AFAIK, , "" , richedit. -, , " " Windows, RichEdits.

2008, Msftedit.dll MSFTEDIT_CLASS (MS - ).

docs Win32.

+2

, , , .dll . , , , RichEdit DllMain riched20.dll.

+2

Is there an import library (possibly riched20.lib) that you can connect to. Then you do not have to download it "manually" at runtime. This is how all standard controls work. VS automatically adds a link to user32.lib when creating a project.

+1
source

I think you need to call CoInitializeEx before creating any common controls.

LoadLibrary is not required. If you link to the correct .lib file, exe-loader will take care of such details for you.

0
source

Source: https://habr.com/ru/post/1697059/


All Articles