MainFrm.cpp
上传用户:zjyq009
上传日期:2022-07-10
资源大小:3154k
文件大小:3k
源码类别:

图形/文字识别

开发平台:

Visual C++

  1. // MainFrm.cpp : implementation of the CMainFrame class
  2. //
  3. #include "stdafx.h"
  4. #include "DigitRec.h"
  5. #include "MainFrm.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CMainFrame
  13. IMPLEMENT_DYNAMIC(CMainFrame, CFrameWnd)
  14. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  15. //{{AFX_MSG_MAP(CMainFrame)
  16. ON_WM_CREATE()
  17. ON_WM_SETFOCUS()
  18. ON_COMMAND(ID_Mid, OnMid)
  19. //}}AFX_MSG_MAP
  20. END_MESSAGE_MAP()
  21. static UINT indicators[] =
  22. {
  23. ID_SEPARATOR,           // status line indicator
  24. ID_INDICATOR_CAPS,
  25. ID_INDICATOR_NUM,
  26. ID_INDICATOR_SCRL,
  27. };
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CMainFrame construction/destruction
  30. CMainFrame::CMainFrame()
  31. {
  32. // TODO: add member initialization code here
  33. }
  34. CMainFrame::~CMainFrame()
  35. {
  36. }
  37. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  38. {
  39. if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  40. return -1;
  41. // create a view to occupy the client area of the frame
  42. if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
  43. CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
  44. {
  45. TRACE0("Failed to create view windown");
  46. return -1;
  47. }
  48. if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
  49. | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
  50. !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  51. {
  52. TRACE0("Failed to create toolbarn");
  53. return -1;      // fail to create
  54. }
  55. if (!m_wndStatusBar.Create(this) ||
  56. !m_wndStatusBar.SetIndicators(indicators,
  57.   sizeof(indicators)/sizeof(UINT)))
  58. {
  59. TRACE0("Failed to create statusbarn");
  60. return -1;      // fail to create
  61. }
  62. // TODO: Delete these three lines if you don't want the toolbar to
  63. //  be dockable
  64. m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
  65. EnableDocking(CBRS_ALIGN_ANY);
  66. DockControlBar(&m_wndToolBar);
  67. return 0;
  68. }
  69. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  70. {
  71. if( !CFrameWnd::PreCreateWindow(cs) )
  72. return FALSE;
  73. // TODO: Modify the Window class or styles here by modifying
  74. //  the CREATESTRUCT cs
  75. cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
  76. cs.lpszClass = AfxRegisterWndClass(0);
  77. return TRUE;
  78. }
  79. /////////////////////////////////////////////////////////////////////////////
  80. // CMainFrame diagnostics
  81. #ifdef _DEBUG
  82. void CMainFrame::AssertValid() const
  83. {
  84. CFrameWnd::AssertValid();
  85. }
  86. void CMainFrame::Dump(CDumpContext& dc) const
  87. {
  88. CFrameWnd::Dump(dc);
  89. }
  90. #endif //_DEBUG
  91. /////////////////////////////////////////////////////////////////////////////
  92. // CMainFrame message handlers
  93. void CMainFrame::OnSetFocus(CWnd* pOldWnd)
  94. {
  95. // forward focus to the view window
  96. m_wndView.SetFocus();
  97. }
  98. BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
  99. {
  100. // let the view have first crack at the command
  101. if (m_wndView.OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
  102. return TRUE;
  103. // otherwise, do default handling
  104. return CFrameWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
  105. }
  106. void CMainFrame::OnMid() 
  107. {
  108. // TODO: Add your command handler code here
  109. }