- HMODULE hRichEditDll = NULL;
- WM_CREATE:
- {
- hRichEditDll = LoadLibrary(_T("RICHED20.dll"));
- HWND hRichEdit = CreateWindowEx(WS_EX_CLIENTEDGE,
- _T("RichEdit20W"),
- NULL,
- WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | ES_MULTILINE | ES_NOHIDESEL,
- 0, 0, 100, 100, hWnd, 0, hInstance, 0);
- }
- break;
- // 最后释放DLL
- FreeLibrary(hRichEditDll);hRichEditDll = NULL;
利用CreateWindowEx创建RichEdit Control之前,需先加载RICHED20.dll这个库,然后才可以CreateWindowEx(..,_T("RichEdit20W"),...);否则的话,CreateWindowEx会失败,GetLastError()返回值为1407:
找不到窗口类名.