MainFrm.cpp
上传用户:jxd368
上传日期:2013-06-20
资源大小:66k
文件大小:2k
源码类别:

文本生成

开发平台:

Visual C++

  1. // MainFrm.cpp : CMainFrame 类的实现
  2. //
  3. #include "stdafx.h"
  4. #include "CText2.h"
  5. #include "MainFrm.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #endif
  9. // CMainFrame
  10. IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
  11. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  12. ON_WM_CREATE()
  13. END_MESSAGE_MAP()
  14. static UINT indicators[] =
  15. {
  16. ID_SEPARATOR,           // 状态行指示器
  17. ID_INDICATOR_CAPS,
  18. ID_INDICATOR_NUM,
  19. ID_INDICATOR_SCRL,
  20. };
  21. // CMainFrame 构造/析构
  22. CMainFrame::CMainFrame()
  23. {
  24. // TODO: 在此添加成员初始化代码
  25. }
  26. CMainFrame::~CMainFrame()
  27. {
  28. }
  29. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  30. {
  31. if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  32. return -1;
  33. /*if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
  34. | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
  35. !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  36. {
  37. TRACE0("未能创建工具栏n");
  38. return -1;      // 未能创建
  39. }
  40. if (!m_wndStatusBar.Create(this) ||
  41. !m_wndStatusBar.SetIndicators(indicators,
  42.   sizeof(indicators)/sizeof(UINT)))
  43. {
  44. TRACE0("未能创建状态栏n");
  45. return -1;      // 未能创建
  46. }
  47. // TODO: 如果不需要工具栏可停靠,则删除这三行
  48. m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
  49. EnableDocking(CBRS_ALIGN_ANY);
  50. DockControlBar(&m_wndToolBar);*/
  51. return 0;
  52. }
  53. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  54. {
  55. if( !CFrameWnd::PreCreateWindow(cs) )
  56. return FALSE;
  57. // TODO: 在此处通过修改 CREATESTRUCT cs 来修改窗口类或
  58. // 样式
  59. HDC hdc=::GetDC(m_hWnd);
  60. cs.cx=GetDeviceCaps(hdc,HORZRES);
  61. cs.cy=GetDeviceCaps(hdc,VERTRES);
  62. return TRUE;
  63. }
  64. // CMainFrame 诊断
  65. #ifdef _DEBUG
  66. void CMainFrame::AssertValid() const
  67. {
  68. CFrameWnd::AssertValid();
  69. }
  70. void CMainFrame::Dump(CDumpContext& dc) const
  71. {
  72. CFrameWnd::Dump(dc);
  73. }
  74. #endif //_DEBUG
  75. // CMainFrame 消息处理程序