1、 protected: / 仅从序列化创建 CMainFrame(); DECLARE_DYNCREATE(CMainFrame)/ 特性public:/ 操作/ 重写 virtual BOOL PreCreateWindow(CREATESTRUCT& cs); virtual BOOL LoadFrame(UINT nIDResource, DWORD dwDefaultStyle = WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, CWnd* pParentWnd = NULL, CCreateContext* pContext = NULL);/ 实现 vi
2、rtual CMainFrame();#ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const;#endif / 控件条嵌入成员 CMFCMenuBar m_wndMenuBar; CMFCToolBar m_wndToolBar; CMFCStatusBar m_wndStatusBar; CMFCToolBarImages m_UserImages;/ 生成的消息映射函数 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruc
3、t); afx_msg void OnViewCustomize();(续) afx_msg LRESULT OnToolbarCreateNew(WPARAM wp, LPARAM lp); DECLARE_MESSAGE_MAP();/ MyThread.h : MyThread 应用程序的主头文件#ifndef _AFXWIN_H_ #error 在包含此文件之前包含“stdafx.h”以生成 PCH 文件#include resource.h / 主符号/ CMyThreadApp:/ 有关此类的实现,请参阅 MyThread.cppclass CMyThreadApp : publi
4、c CWinAppEx CMyThreadApp(); virtual BOOL InitInstance(); virtual int ExitInstance(); BOOL m_bHiColorIcons; virtual void PreLoadState(); virtual void LoadCustomState(); virtual void SaveCustomState(); afx_msg void OnAppAbout();extern CMyThreadApp theApp;/ MyThreadDoc.h : CMyThreadDoc 类的接口class CMyThr
5、eadDoc : public CDocument CMyThreadDoc(); DECLARE_DYNCREATE(CMyThreadDoc) virtual BOOL OnNewDocument(); virtual void Serialize(CArchive& ar);#ifdef SHARED_HANDLERS virtual void InitializeSearchContent(); virtual void OnDrawThumbnail(CDC& dc, LPRECT lprcBounds);#endif / SHARED_HANDLERS virtual CMyThr
6、eadDoc(); / 用于为搜索处理程序设置搜索内容的 Helper 函数 void SetSearchContent(const CString& value);/ MyThreadView.h : CMyThreadView 类的接口class CMyThreadView : public CView CMyThreadView(); DECLARE_DYNCREATE(CMyThreadView) CMyThreadDoc* GetDocument() const; virtual void OnDraw(CDC* pDC); / 重写以绘制该视图 virtual BOOL OnPre
7、parePrinting(CPrintInfo* pInfo); virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo); virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo); virtual CMyThreadView(); afx_msg void OnFilePrintPreview(); afx_msg void OnRButtonUp(UINT nFlags, CPoint point); afx_msg void OnContextMenu(CWnd* pWnd,
8、 CPoint point); afx_msg void OnStartthread(); afx_msg void OnStopthread();#ifndef _DEBUG / MyThreadView.cpp 中的调试版本inline CMyThreadDoc* CMyThreadView:GetDocument() const return reinterpret_cast(m_pDocument); / MainFrm.cpp : CMainFrame 类的实现stdafx.hMyThread.hMainFrm.h#define new DEBUG_NEW/ CMainFrameIM
9、PLEMENT_DYNCREATE(CMainFrame, CFrameWndEx)const int iMaxUserToolbars = 10;const UINT uiFirstUserToolBarId = AFX_IDW_CONTROLBAR_FIRST + 40;const UINT uiLastUserToolBarId = uiFirstUserToolBarId + iMaxUserToolbars - 1;BEGIN_MESSAGE_MAP(CMainFrame, CFrameWndEx) ON_WM_CREATE() ON_COMMAND(ID_VIEW_CUSTOMIZ
10、E, &CMainFrame:OnViewCustomize) ON_REGISTERED_MESSAGE(AFX_WM_CREATETOOLBAR, &OnToolbarCreateNew)END_MESSAGE_MAP()static UINT indicators = ID_SEPARATOR, / 状态行指示器 ID_INDICATOR_CAPS, ID_INDICATOR_NUM, ID_INDICATOR_SCRL,/ CMainFrame 构造/析构CMainFrame() / TODO: 在此添加成员初始化代码CMainFrame()int CMainFrame:OnCreat
11、e(LPCREATESTRUCT lpCreateStruct) if (CFrameWndEx:OnCreate(lpCreateStruct) = -1) return -1; BOOL bNameValid; / 设置用于绘制所有用户界面元素的视觉管理器 CMFCVisualManager:SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerVS2008); if (!m_wndMenuBar.Create(this) TRACE0(未能创建菜单栏n); / 未能创建 m_wndMenuBar.SetPaneStyle(m_wndMenuBar.GetPaneStyle() | CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY); / 防止菜单栏在激活时获得焦点 CMFCPopupMenu:SetForceMenuFocus(FALSE);m_wndToolBar.Creat
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1