c++程序问题
WNDCLASSwndcls;wndcls.CbClsExtra=0;wndcls.CbWndExtra=0;wndcls.HbrBackground=(HBRUSH)G...
WNDCLASS wndcls;
wndcls.CbClsExtra=0;
wndcls.CbWndExtra=0;
wndcls.HbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
wndcls.HCursor=loadcursor(NULL,IDC_cross);
wndcls.HIcon=loadicon(NULL,IDI_error);
wndcls.HInstance=HInstance;
wndcls.LpfnWndProc=winsunproc;
wndcls.LpszClassName="menghuanguaishou";
wndcls.LpszMenuName=null;
wndcls.Style=CS_HREDRAW | CS_VREDRAW;
RegisterClass(wndcls);
HWND hwnd;
大家看看这几行程序,显示错误
C:\Documents and Settings\Administrator\桌面\winmain.cpp(18) : error C2039: 'CbClsExtra' : is not a member of 'tagWNDCLASSA'
d:\vc98\include\winuser.h(1184) : see declaration of 'tagWNDCLASSA'
C:\Documents and Settings\Administrator\桌面\winmain.cpp(19) : error C2039: 'CbWndExtra' : is not a member of 'tagWNDCLASSA'
d:\vc98\include\winuser.h(1184) : see declaration of 'tagWNDCLASSA'
C:\Documents and Settings\Administrator\桌面\winmain.cpp(20) : error C2039: 'HbrBackground' : is not a member of 'tagWNDCLASSA'
d:\vc98\include\winuser.h(1184) : see declaration of 'tagWNDCLASSA'
C:\Documents and Settings\Administrator\桌面\winmain.cpp(21) : error C2039: 'HCursor' : is not a member of 'tagWNDCLASSA'
d:\vc98\include\winuser.h(1184) : see declaration of 'tagWNDCLASSA'
C:\Documents and Settings\Administrator\桌面\winmain.cpp(21) : error C2065: 'loadcursor' : undeclared identifier
C:\Documents and Settings\Administrator\桌面\winmain.cpp(21) : error C2065: 'IDC_cross' : undeclared identifier
C:\Documents and Settings\Administrator\桌面\winmain.cpp(22) : error C2039: 'HIcon' : is not a member of 'tagWNDCLASSA'
d:\vc98\include\winuser.h(1184) : see declaration of 'tagWNDCLASSA'
C:\Documents and Settings\Administrator\桌面\winmain.cpp(22) : error C2065: 'loadicon' : undeclared identifier
C:\Documents and Settings\Administrator\桌面\winmain.cpp(22) : error C2065: 'idi_error' : undeclared identifier
C:\Documents and Settings\Administrator\桌面\winmain.cpp(23) : error C2039: 'HInstance' : is not a member of 'tagWNDCLASSA'
d:\vc98\include\winuser.h(1184) : see declaration of 'tagWNDCLASSA'
C:\Documents and Settings\Administrator\桌面\winmain.cpp(24) : error C2039: 'LpfnWndProc' : is not a member of 'tagWNDCLASSA'
d:\vc98\include\winuser.h(1184) : see declaration of 'tagWNDCLASSA'
C:\Documents and Settings\Administrator\桌面\winmain.cpp(24) : error C2065: 'winsunproc' : undeclared identifier
C:\Documents and Settings\Administrator\桌面\winmain.cpp(25) : error C2039: 'LpszClassName' : is not a member of 'tagWNDCLASSA'
d:\vc98\include\winuser.h(1184) : see declaration of 'tagWNDCLASSA'
为什么所有成员都不对呢
我是在msdn中抄的啊,看截图。能不能告诉我怎么不用抄,直接列出类的成员变量,好像有一个办法 展开
wndcls.CbClsExtra=0;
wndcls.CbWndExtra=0;
wndcls.HbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
wndcls.HCursor=loadcursor(NULL,IDC_cross);
wndcls.HIcon=loadicon(NULL,IDI_error);
wndcls.HInstance=HInstance;
wndcls.LpfnWndProc=winsunproc;
wndcls.LpszClassName="menghuanguaishou";
wndcls.LpszMenuName=null;
wndcls.Style=CS_HREDRAW | CS_VREDRAW;
RegisterClass(wndcls);
HWND hwnd;
大家看看这几行程序,显示错误
C:\Documents and Settings\Administrator\桌面\winmain.cpp(18) : error C2039: 'CbClsExtra' : is not a member of 'tagWNDCLASSA'
d:\vc98\include\winuser.h(1184) : see declaration of 'tagWNDCLASSA'
C:\Documents and Settings\Administrator\桌面\winmain.cpp(19) : error C2039: 'CbWndExtra' : is not a member of 'tagWNDCLASSA'
d:\vc98\include\winuser.h(1184) : see declaration of 'tagWNDCLASSA'
C:\Documents and Settings\Administrator\桌面\winmain.cpp(20) : error C2039: 'HbrBackground' : is not a member of 'tagWNDCLASSA'
d:\vc98\include\winuser.h(1184) : see declaration of 'tagWNDCLASSA'
C:\Documents and Settings\Administrator\桌面\winmain.cpp(21) : error C2039: 'HCursor' : is not a member of 'tagWNDCLASSA'
d:\vc98\include\winuser.h(1184) : see declaration of 'tagWNDCLASSA'
C:\Documents and Settings\Administrator\桌面\winmain.cpp(21) : error C2065: 'loadcursor' : undeclared identifier
C:\Documents and Settings\Administrator\桌面\winmain.cpp(21) : error C2065: 'IDC_cross' : undeclared identifier
C:\Documents and Settings\Administrator\桌面\winmain.cpp(22) : error C2039: 'HIcon' : is not a member of 'tagWNDCLASSA'
d:\vc98\include\winuser.h(1184) : see declaration of 'tagWNDCLASSA'
C:\Documents and Settings\Administrator\桌面\winmain.cpp(22) : error C2065: 'loadicon' : undeclared identifier
C:\Documents and Settings\Administrator\桌面\winmain.cpp(22) : error C2065: 'idi_error' : undeclared identifier
C:\Documents and Settings\Administrator\桌面\winmain.cpp(23) : error C2039: 'HInstance' : is not a member of 'tagWNDCLASSA'
d:\vc98\include\winuser.h(1184) : see declaration of 'tagWNDCLASSA'
C:\Documents and Settings\Administrator\桌面\winmain.cpp(24) : error C2039: 'LpfnWndProc' : is not a member of 'tagWNDCLASSA'
d:\vc98\include\winuser.h(1184) : see declaration of 'tagWNDCLASSA'
C:\Documents and Settings\Administrator\桌面\winmain.cpp(24) : error C2065: 'winsunproc' : undeclared identifier
C:\Documents and Settings\Administrator\桌面\winmain.cpp(25) : error C2039: 'LpszClassName' : is not a member of 'tagWNDCLASSA'
d:\vc98\include\winuser.h(1184) : see declaration of 'tagWNDCLASSA'
为什么所有成员都不对呢
我是在msdn中抄的啊,看截图。能不能告诉我怎么不用抄,直接列出类的成员变量,好像有一个办法 展开
3个回答
展开全部
大小写啦,像“CbClsExtra"就改写成“cbClsExtra”~~~C++对大小写可是很敏感的哦~~你这样写他死脑筋的不会认识的。
话说我不知道怎么补充回答...
我看你的那个截图咋是SDK的呢~~~好像不是给C++用的吧...(我用的是VC2008的帮助文档,对这个也不清楚,说的不一定对哈)
另外,你的编辑器是VC++吗,他本身有一个智能的啥功能(记不得名字了)...就是你有一个类或者机构体的实例后,它自会给你列出来其中的变量和函数...
如果没有这种情况,你可以先关闭工程,再跑到你的工程目录下,把一个.ncb的文件删去,然后再重新编译...这样能解决问题。如果你编译器压根就没有这功能的话,换一个吧...
另外,给LL点建议哈,嘿嘿。乍看您应该刚学VC,而你写的这个程序的结构属于win32应用程序结构,是一种基本的结构,虽然简单,但也是非常有含量的,我现在也才刚刚理解呢...建议你先跳过这块,能理解多少就理解多少,去学后面的MFC吧,当你了解VC的操作,了解VC的基本操作和一些语法时,再回头来看这部分吧~~~多看些参考书吧,VC门槛比较高,自己摸索会很费事的...
祝C++有成~~
话说我不知道怎么补充回答...
我看你的那个截图咋是SDK的呢~~~好像不是给C++用的吧...(我用的是VC2008的帮助文档,对这个也不清楚,说的不一定对哈)
另外,你的编辑器是VC++吗,他本身有一个智能的啥功能(记不得名字了)...就是你有一个类或者机构体的实例后,它自会给你列出来其中的变量和函数...
如果没有这种情况,你可以先关闭工程,再跑到你的工程目录下,把一个.ncb的文件删去,然后再重新编译...这样能解决问题。如果你编译器压根就没有这功能的话,换一个吧...
另外,给LL点建议哈,嘿嘿。乍看您应该刚学VC,而你写的这个程序的结构属于win32应用程序结构,是一种基本的结构,虽然简单,但也是非常有含量的,我现在也才刚刚理解呢...建议你先跳过这块,能理解多少就理解多少,去学后面的MFC吧,当你了解VC的操作,了解VC的基本操作和一些语法时,再回头来看这部分吧~~~多看些参考书吧,VC门槛比较高,自己摸索会很费事的...
祝C++有成~~
2011-04-10
展开全部
厄,确实是,第一个字母都是小写的!呵呵
typedef struct _WNDCLASS {
UINT style;
WNDPROC lpfnWndProc;
int cbClsExtra;
int cbWndExtra;
HANDLE hInstance;
HICON hIcon;
HCURSOR hCursor;
HBRUSH hbrBackground;
LPCTSTR lpszMenuName;
LPCTSTR lpszClassName;
} WNDCLASS;
看到了吧?
在VS环境里,鼠标对准WNDCLASS,按右键,选择“转到定义”
typedef struct _WNDCLASS {
UINT style;
WNDPROC lpfnWndProc;
int cbClsExtra;
int cbWndExtra;
HANDLE hInstance;
HICON hIcon;
HCURSOR hCursor;
HBRUSH hbrBackground;
LPCTSTR lpszMenuName;
LPCTSTR lpszClassName;
} WNDCLASS;
看到了吧?
在VS环境里,鼠标对准WNDCLASS,按右键,选择“转到定义”
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你给的程序里咋没有tagWNDCLASSA这个变量????
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询