sdk文档中说richedit是标准控件,可以通过"RichEdit"或RICHEDIT_CLASS直接创建,不需注册窗口类,可以我用这两个方法创建richedit都创建不出来,提示没有窗口类.我的代码如下:
hRichEdit = CreateWindowEx(0, "RICHEDIT", NULL, WS_CHILD | WS_VISIBLE | ES_MULTILINE  ,
                            0, 0, 200, 160, hWnd, (HMENU)1, hInstance, NULL) ;
请问是我的代码有错误啊,还是哪里需要设置阿.谢谢

解决方案 »

  1.   

    // Handle to the LIB for the RTFEDIT control
    HANDLE hRTFLib;
    // Load the rich edit DLL
    hRTFLib = LoadLibrary("RICHED32.DLL");
     // Create the rich edit control.            
    hWndRichEdit = CreateWindowEx(
                      WS_EX_CLIENTEDGE,    // make rich edit control appear "sunken"
                      "RICHEDIT",          // class name of rich edit control
                      "",                  // text of rich edit control
                      WS_CHILD | WS_VISIBLE | ES_MULTILINE | ES_SAVESEL |
                        WS_HSCROLL | WS_VSCROLL,    // window style
                      0, 0,                // initially create 0 size,
                      0, 0,                // main window's WM_SIZE handler will resize
                      hWnd,                // use main parent
                      (HMENU)ID_RICHED,    // ID 
                      hInst,               // this app instance owns this window
                      NULL  );在MSDN 2001中有完整的例子