| 编程中国 | 业界新闻 | 技术文章 | 视频教程 | 下载频道 | 程序源码 | 个人空间 | 编程论坛
全能ASP/PHP/ASP.NET主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付赛孚耐:软件保护加密专家
身份认证令牌USB KEY   
共有 682 人关注过本帖
标题:mfc中全局变量的使用,::m_pMainWnd使用的时候,是不是要包含什么头文件
收藏  订阅  推荐  打印 
Mycr
Rank: 3Rank: 3
等级:中级会员
帖子:203
积分:2184
注册:2006-9-18
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-5 09:42
raulxxyuer
Rank: 2
等级:注册会员
威望:1
帖子:178
积分:1888
注册:2007-4-23

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-5 15:36
Mycr
Rank: 3Rank: 3
等级:中级会员
帖子:203
积分:2184
注册:2006-9-18

我添加了头文件了,还是不行?

2007-12-5 16:55
raulxxyuer
Rank: 2
等级:注册会员
威望:1
帖子:178
积分:1888
注册:2007-4-23

m_pMainWnd是global类型吗.为什么你加上::呢.你再试试

我很沒用,總是學不會遺忘,總是學不會割捨本不屬於我的東西。
2007-12-5 17:21
Mycr
Rank: 3Rank: 3
等级:中级会员
帖子:203
积分:2184
注册:2006-9-18

可能是书有问题吧,我把::去掉就行了

2007-12-6 15:06
关于我们 | 广告合作 | 编程中国 | 清除Cookies | Archiver | WAP | TOP

编程中国 版权所有,并保留所有权利。鲁ICP备08000592号
Powered by Discuz, Processed in 0.054741 second(s), 9 queries.
Copyright©2004-2008, BCCN.NET, All Rights Reserved