RichEditCtrlEx.cpp
上传用户:xztxsm
上传日期:2007-01-02
资源大小:23k
文件大小:2k
源码类别:

RichEdit

开发平台:

Visual C++

  1. // RichEditCtrlEx.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "myrich.h"
  5. #include "RichEditCtrlEx.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. _AFX_RICHEDITEX_STATE::_AFX_RICHEDITEX_STATE()
  12. {
  13.     m_hInstRichEdit20 = NULL ;
  14. }
  15. _AFX_RICHEDITEX_STATE::~_AFX_RICHEDITEX_STATE()
  16. {
  17.     if( m_hInstRichEdit20 != NULL )
  18.     {
  19.         ::FreeLibrary( m_hInstRichEdit20 ) ;
  20.     }
  21. }
  22. _AFX_RICHEDITEX_STATE _afxRichEditStateEx ;
  23. BOOL PASCAL AfxInitRichEditEx()
  24. {
  25.     if( ! ::AfxInitRichEdit() )
  26.     {
  27.         return FALSE ;
  28.     }
  29.     _AFX_RICHEDITEX_STATE* l_pState = &_afxRichEditStateEx ;
  30.     if( l_pState->m_hInstRichEdit20 == NULL )
  31.     {
  32.         l_pState->m_hInstRichEdit20 = LoadLibraryA("RICHED20.DLL") ;
  33.     }
  34.     return l_pState->m_hInstRichEdit20 != NULL ;
  35. }
  36. /////////////////////////////////////////////////////////////////////////////
  37. // CRichEditCtrlEx
  38. CRichEditCtrlEx::CRichEditCtrlEx()
  39. {
  40. }
  41. CRichEditCtrlEx::~CRichEditCtrlEx()
  42. {
  43. }
  44. BEGIN_MESSAGE_MAP(CRichEditCtrlEx, CRichEditCtrl)
  45. //{{AFX_MSG_MAP(CRichEditCtrlEx)
  46. // NOTE - the ClassWizard will add and remove mapping macros here.
  47. //}}AFX_MSG_MAP
  48. END_MESSAGE_MAP()
  49. /////////////////////////////////////////////////////////////////////////////
  50. // CRichEditCtrlEx message handlers
  51. BOOL CRichEditCtrlEx::Create(DWORD in_dwStyle,  const RECT& in_rcRect,
  52.                              CWnd* in_pParentWnd, UINT in_nID)
  53. {
  54.     if( ! ::AfxInitRichEditEx() )
  55.     {
  56.         return FALSE ;
  57.     }
  58.     CWnd* l_pWnd = this ;
  59.     return l_pWnd->Create( _T( "RichEdit20A" ), NULL, in_dwStyle, 
  60.                            in_rcRect, in_pParentWnd, in_nID );
  61. }
  62. BOOL CRichEditCtrlEx::CreateEx(DWORD dwExStyle, LPCTSTR lpszClassName,
  63. LPCTSTR lpszWindowName, DWORD dwStyle,
  64. const RECT& rect, CWnd* pParentWnd, UINT nID,
  65. LPVOID lpParam /* = NULL */)
  66. {
  67. /* return CreateEx(dwExStyle, lpszClassName, lpszWindowName, dwStyle,
  68. rect,(pParentWnd != NULL) ? pParentWnd->GetSafeHwnd() : NULL,
  69. (HMENU) nID, lpParam);
  70. */
  71. CWnd* l_pWnd = this ;
  72.     return l_pWnd->CreateEx(dwExStyle, _T( "RichEdit20A" ), NULL, dwStyle, 
  73.                            rect, pParentWnd, nID, NULL );
  74. }