Rich Edit Controls 的文档真的像看起来那样糟糕(错误吗?)?现在,我正在手动调用 LoadLibrary("riched20.dll") 以便显示 Rich Edit 控件。 Rich Edit 的文档在使用 Rich Edit 控件的第一个代码示例中对此进行了很差的演示。
它讨论了调用 InitCommonControlsEx() 来添加视觉样式,但没有提及要传入哪些标志。
有没有更好的方法来加载 Rich Edit 控件?
http://msdn.microsoft.com/en-us/library/bb787877(VS.85).aspx http://msdn.microsoft.com/en-us/library/bb787877(VS.85).aspx
这是我可以编写使其工作的唯一代码:
#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);