我的程序中用到了RichEdit控件,是不是需要调用InitCommonControls()函数才能正确使用它?我使用 InitCommonControls()函数,编译程序却提示不能解析对InitCommonControls的调用,我该额外链接哪个库呢?

解决方案 »

  1.   

    RichEdit控件的初始化:
    AfxInitRichEdit();
      

  2.   

    我是在SDK程序中使用的,没有用到MFC。
      

  3.   

    关于InitCommonControls函数的需求:Minimum DLL Version        comctl32.dll 
    Header                    commctrl.h 
    Import library          comctl32.lib 
    Minimum operating systems Windows NT 3.51, Windows 95 
      

  4.   

    Include Commctrl.h in Stdafx.h file.(include Afxcmn.h if application has MFC support). 
    #include <commctrl.h> 
      

  5.   


    Header: commctrl.h 
    Import: library comctl32.lib 
      

  6.   

    还是不行啊。GetLastError()返回代码1407,我查了下MSDN,它表示未找到窗口类。难道是没有找到RichEdit的窗口类?
      

  7.   

    我找到原因了:除了要求头文件commctrl.h和连接comctl32.lib外,还应该在创建RichEdit控件前调用LoadLibrary(TEXT("RichEd32.dll"));只有这样才能使用RichEdit控件。
    我是看MSDN的例子程序,偶然发现的,真是想不到啊。