读书人

CDC类有关问题声明一个CDC对象竟然

发布时间: 2012-02-03 22:02:47 作者: rapoo

CDC类问题,声明一个CDC对象,竟然找不到GetDC()成员函数??
CDC * pDC=CDC::GetDC();

编译错误:
error C2039: 'GetDC' : is not a member of 'CDC'
d:\program files\microsoft visual studio\vc98\mfc\include\afxwin.h(636) : see declaration of 'CDC'
error C2660: 'GetDC' : function does not take 0 parameters

[解决办法]

探讨
是这样的,我的CDC对象是声明在主程序类的一个自定义成员函数中的,代码如下:
void CGISApp::CGIS_ReadFile(CString filename)
{
............

CDC *pDC = this->GetDC();

............

}
我用CDC *pDC = this->GetDC();后,编译错误为error C2039: 'GetDC' : is not a member of 'CGISApp'

其中CGISApp为主程序类,继承于CWinApp

读书人网 >VC/MFC

热点推荐