VC6.0使用RichEdit2.0(GifOleControl 1.0.2 補充說明)

來源:互聯網
上載者:User

由於AfxInitRichEdit() 裝載的是 RichEdit 1.0 Control (RICHED32.DLL),該版本BUG較多,需要在裝載3.0的控制項。方法如下:

 

以對話方塊為例:
       (1)    增加一全域變數 HMODULE hMod;
       (2)    在CxxxApp::InitInstance()中添加一句hMod = LoadLibrary(_T("riched32.dll"));
              在CxxxApp::ExitInstance()中添加一句FreeLibrary(hMod);
       (3)      在對話方塊上放一個richedit,文本方式開啟.rc檔案修改該richedit控制項的類名"RICHEDIT" to  "RichEdit20a".

      如果對話方塊不出現,則在添加  AfxInitRichEdit 方法。

 

VC.NET以後版本:(msdn上的做法,適用於用VC.NET及以後版本建立的工程)
            To update rich edit controls in existing Visual C++ applications to version 2.0,
            open the .RC file as text, change the class name of each rich edit control from   "RICHEDIT" to  "RichEdit20a".
            Then replace the call to AfxInitRichEdit with AfxInitRichEdit2.

 

動態載入richedit2.0:

 

在標頭檔中定義:

 

#define _RICHEDIT_VER 0x0300

#if (_RICHEDIT_VER >= 0x0200 )
#ifdef UNICODE
#define RICHEDIT_CLASS  RICHEDIT_CLASSW
#else
#define RICHEDIT_CLASS  RICHEDIT_CLASSA
#endif /* UNICODE */
#else
#define RICHEDIT_CLASS  RICHEDIT_CLASS10A
#endif /* _RICHEDIT_VER >= 0x0200 */

 

則可以使用動態載入richedit:

 CRichEditCtrl::CreateEx(NULL,RICHEDIT_CLASS,NULL, dwStyle&~WS_BORDER, rect, pParentWnd, nID);

 

 

申明:該控制項可以免費使用。禁止惡意修改控制項的版本資訊。

 

DEMO下載:http://sv004d.mofile.com/7125120180791962/RGlzazEvNTQvNTQyNzI4MTQyMC83Lzc0OTQ0NjQwNjA4NjQ1Nw../TestGif.rar

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.