00 Win32 SDK创建RichEdit Control控件

Post date: 2012/4/24 上午 06:43:57

  1. HMODULE hRichEditDll = NULL;
  2. WM_CREATE:
  3. {
  4. hRichEditDll = LoadLibrary(_T("RICHED20.dll"));
  5. HWND hRichEdit = CreateWindowEx(WS_EX_CLIENTEDGE,
  6. _T("RichEdit20W"),
  7. NULL,
  8. WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | ES_MULTILINE | ES_NOHIDESEL,
  9. 0, 0, 100, 100, hWnd, 0, hInstance, 0);
  10. }
  11. break;
  12. // 最后释放DLL
  13. FreeLibrary(hRichEditDll);hRichEditDll = NULL;

利用CreateWindowEx创建RichEdit Control之前,需先加载RICHED20.dll这个库,然后才可以CreateWindowEx(..,_T("RichEdit20W"),...);否则的话,CreateWindowEx会失败,GetLastError()返回值为1407: 找不到窗口类名.