| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1567 人关注过本帖
标题:mfc中全局变量的使用,::m_pMainWnd使用的时候,是不是要包含什么头文件
只看楼主 加入收藏
Mycr
Rank: 1
等 级:新手上路
帖 子:203
专家分:0
注 册:2006-9-18
收藏
 问题点数:0 回复次数:4 
mfc中全局变量的使用,::m_pMainWnd使用的时候,是不是要包含什么头文件
::m_pMainWnd=new CancasForm;
 ::m_pMainWnd->ShowWindow(::m_nCmdShow);
 ::m_pMainWnd->UpdateWindow();
 return TRUE;

为什么我添加::运行就会出错
'm_pMainWnd' : is not a member of '`global namespace''

去掉就对了
搜索更多相关主题的帖子: pMainWnd mfc 变量 全局 文件 
2007-12-05 09:42
raulxxyuer
Rank: 1
等 级:新手上路
威 望:1
帖 子:178
专家分:0
注 册:2007-4-23
收藏
得分:0 
CWinThread::m_pMainWnd
This data member contains a pointer to a CWnd object. Use this data member to store a pointer to the main window object of your thread.

The MFC for Windows CE automatically terminates your thread when the window referred to by m_pMainWnd is closed. If this thread is the primary thread for an application, the application will also be terminated. If this data member is NULL, the main window for the CWinApp object of the application will be used to determine when to terminate the thread. m_pMainWnd is a public variable of type CWnd*.

Typically, you set this member variable when you override InitInstance. In a worker thread, the value of this data member is inherited from its parent thread.

CWnd* m_pMainWnd;
Requirements
  Windows CE versions: 1.0 and later
  Header file: Declared in Afxwin.h
  Platform: H/PC Pro, Palm-size PC, Pocket PC

See Also
CWinThread::InitInstance, CWnd
多查查MSDN不就知道这些了呢

我很沒用,總是學不會遺忘,總是學不會割捨本不屬於我的東西。
2007-12-05 15:36
Mycr
Rank: 1
等 级:新手上路
帖 子:203
专家分:0
注 册:2006-9-18
收藏
得分:0 
我添加了头文件了,还是不行?

2007-12-05 16:55
raulxxyuer
Rank: 1
等 级:新手上路
威 望:1
帖 子:178
专家分:0
注 册:2007-4-23
收藏
得分:0 
m_pMainWnd是global类型吗.为什么你加上::呢.你再试试

我很沒用,總是學不會遺忘,總是學不會割捨本不屬於我的東西。
2007-12-05 17:21
Mycr
Rank: 1
等 级:新手上路
帖 子:203
专家分:0
注 册:2006-9-18
收藏
得分:0 
可能是书有问题吧,我把::去掉就行了

2007-12-06 15:06
快速回复:mfc中全局变量的使用,::m_pMainWnd使用的时候,是不是要包含什么头 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.021715 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved