// CMainFrame message handlers
void CMainFrame::OnSwitchView()
{
// TODO: Add your command handler code here
if(!B_TestView)
{
B_TestView=true;
pTestView=this->GetActiveView();
pDynScro
转载
2023-06-17 06:40:52
27阅读
#if _MSC_VER > 1000#pragma once#endif // _MSC_VER > 1000#include class CMainFram
转载
2023-06-18 10:22:22
42阅读
一般做法: 在MFC Program时候,当对菜单进行创建标记菜单项的时候,可以在CMainFrame的OnCreate函数中通过如下代码实现:GetMenu()-GetSubMenu(5)-CheckMenuItem(0,MF_BYPOSITION | MF_UNCHECKED); 可是我们有时候由于某些特殊的要求要在CView类中实现该功能,如果直接在CView的某个消息响应函数中添加以上代码,会有严重警告的错误!因为这样得到的菜单还是主窗口下的菜单即主框架的菜单,而不是对应视图的菜单。CView视图关联的菜单和刚生成主窗口的那个主窗口菜单不一样。我们的目的是要对主窗口的菜单进行操作,
转载
2010-12-24 10:32:00
29阅读
2评论
一般做法: 在MFC Program时候,当对菜单进行创建标记菜单项的时候,可以在CMainFrame的OnCreate函数中通过如下代码实现:GetMenu()->GetSubMenu(5)->CheckMenuItem(0,MF_BYPOSITION | MF_UNCHECKED); 可是我们有时候由于某些特殊的要求要在CView类中实现该功能,如果直接
转载
2011-01-03 13:19:00
41阅读
2评论
CMainFrame *pWnd; pWnd-ScreenToClient(&pt);//ScreenToClient 由于ScreenToClient计算点相对CMainFrame客户区的偏移, 而不是相对CMainFrame窗口左上角的偏移,所以所有的值都为负,而且是以客户区左上角为零点,这就造成无法点在非客户区的位置,如果
转载
2011-01-03 13:26:00
143阅读
2评论
BOOL CMainFrame::PreCreateWindow
转载
2023-05-22 11:31:17
42阅读
框架窗口类的四个成员函数
原创
2008-03-04 13:14:53
3619阅读
1评论
在VC++6.0向导中完成项目迁移到VS2012版的错编译时遇到两个问题,首先是error C2440: “static_cast”: 无法从“void (__thiscall CMainFrame::* )(BOOL,HTASK)”转换为“void (__thiscall CWnd::* )(BOOL,DWORD)”1>
原创
2016-09-30 15:42:11
4557阅读
CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIM
转载
2023-05-22 11:31:39
22阅读
单文档的BCG程序,为什么在CMainFrame::OnCreate最后设置工具条的标题,为什么无效?我们通过如下代码将标题设置为标准m_wndToolBar.SetWindowText (_T("标准")); ------------执行以下代码是会将标题设置回来。 if (!ProcessShellCommand(cmdInfo)) return FALSE;
原创
2022-07-20 19:04:06
53阅读
CMainFrame *pFrame = (CMainFrame*)AfxGetMainWnd();
原创
2022-08-09 17:36:23
21阅读
1、获取应用程序指针CMyApp* pApp=(CMyApp*)AfxGetApp();2、获取主框架指针CWinApp 中的公有成员变量 m_pMainWnd 就是主框架的指针CMainFrame* pMainFrame = (CMainFrame*)(AfxGetApp()->m_pMainWnd);或者CMainFrame* pMainFrame = (CMainFrame*)AfxGe
原创
2021-07-17 10:08:44
445阅读
1、获取应用程序指针
CMyApp* pApp=(CMyApp*)AfxGetApp();
2、获取主框架指针
CWinApp 中的公有成员变量 m_pMainWnd 就是主框架的指针
CMainFrame* pMainFrame = (CMainFrame*)(AfxGetApp()->m_pMainWnd);
或者
CMainFrame* pMainFrame = (CM
转载
2010-08-26 19:17:42
520阅读
MFC指针的获取
1、获取应用程序指针CMyApp* pApp=(CMyApp*)AfxGetApp();2、获取主框架指针CWinApp 中的公有成员变量 m_pMainWnd 就是主框架的指针CMainFrame* pMainFrame = (CMainFrame*)(AfxGetApp()->m_pMainWnd);或者CMainFrame* pMainFra
原创
2021-04-26 09:02:26
491阅读
1、获取应用程序指针
CMyApp* pApp=(CMyApp*)AfxGetApp();
2、获取主框架指针
CWinApp 中的公有成员变量 m_pMainWnd 就是主框架的指针
CMainFrame* pMainFrame = (CMainFrame*)(AfxGetApp()->m_pMainWnd);
或者
CMainFrame* pMainFrame = (
转载
2010-09-26 14:18:00
55阅读
2评论
首先在 CMainFrame 中定义三个共有成员变量public: HBITMAP m_hLogo; int m_nBmpHeight; int m_nBmpWidth;在构造函数、析构函数中CMainFrame::CMainFrame(){ m_hLogo = (H...
转载
2012-03-12 21:58:00
58阅读
2评论
Hello.hclass CHelloApp:public CWinApp{public: virtual BOOL InitInstance();};class CMainFrame:public CFrameWnd{public: CMainFrame(); CRect m_rectBubble[50]; int m_nBubbleCount;publi
原创
2014-10-13 09:30:11
228阅读
1 获取应用程序类(App)指针 在任何类中都可用MFC全局函数AfxGetApp()获得2 获取框架类(MainFrame)指针 1)在App中获得MainFrame指针 CWinApp 中的 m_pMainWnd变量就是MainFrame的指针 也可以: CMainFrame *pMain =(CMainFrame *)AfxGetMainWnd(); 2) 在View中获得MainFrame指针 CMainFrame *pMain=(CMainFrame *)AfxGetApp()->m_pMainWnd;3 获取各种视图类(View)指针 1)(在App,MainFrame,Do
转载
2013-09-26 13:27:00
66阅读
2评论
1窗体外观的改动(1)改动在CMainFrame::preCreateWindow(CREATESTRUCT& cs)改动标题:cs.style&=FWS_ADDTOTITLE;cs.lpszNamw="new title";(2)窗体创建之后改动外观在CMainframe::Create()中调用...
转载
2014-09-10 11:24:00
36阅读
给这个控件设一个类:CReadEdit, 继承自CEditView
CMainFrame* pFrame = (CMainFrame*)AfxGetMainFrame();
CXXDoc* pDoc = (CXXDoc*)pFrame-> GetAct
转载
2011-07-03 15:11:18
453阅读