“cbSize”: 不是“tagWNDCLASSA”的成员
#include<windows.h>
#include "stdafx.h"
#include <stdio.h>
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MSG Msg;
MyRegisterClass(hInstance);
if(!InitInstance(hInstance,nCmdShow))
{
return FALSE;
}
while (GetMessage(&Msg,NULL,0,0))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return Msg.wParam;
}
ATOM MyReisterClass(HINSTANCE hInstance)
{
WNDCLASS wcex;
wcex.cbSize=sizeof(WNDCLASS);
wcex.style=CS_HREDRAW|CS_VREDRAW;
wcex.lpfnWndProc=(WNDPROC)WndProc;
wcex.cbClsExtra=0;
wcex.cbWndExtra=0;
wcex.hInstance=hInstance;
wcex.hIcon=NULL;
wcex.hCursor=NULL;
wcex.hCursor=LoadCursor(NULL,IDC_ARROW);
wcex.hbrBackground=(HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName=NULL;
wcex.lpszClassName="canvas";
wcex.hIconSm=NULL;
return RegisterClassEx(&wcex);
}
BOOL InitInstance(HINSTANCE hInstance,int nCmdshow)
{
HWND hWnd;
hInst=hInstance;
hWnd=CreateWindow("canvas","绘图窗口",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,0,
CW_USEDEFAULT,0,NULL,NULL,hInstance,NULL);
if(!hWnd)
{
return FALSE;
}
MoveWindow(hWnd,10,10,600,450,true);
ShowWindow(hWnd,nCmdshow);
UpdateWindow(hWnd);
return TRUE;
}
444.cpp
1>d:\我的文档\visual studio 2008\projects\444\444\444.cpp(38) : error C2039: “cbSize”: 不是“tagWNDCLASSA”的成员
1> c:\program files\microsoft sdks\windows\v6.0a\include\winuser.h(1566) : 参见“tagWNDCLASSA”的声明
1>d:\我的文档\visual studio 2008\projects\444\444\444.cpp(50) : error C2039: “hIconSm”: 不是“tagWNDCLASSA”的成员
1> c:\program files\microsoft sdks\windows\v6.0a\include\winuser.h(1566) : 参见“tagWNDCLASSA”的声明
1>d:\我的文档\visual studio 2008\projects\444\444\444.cpp(51) : error C2664: “RegisterClassExA”: 不能将参数 1 从“WNDCLASS *”转换为“const WNDCLASSEXA *”
1> 与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换
1>d:\我的文档\visual studio 2008\projects\444\444\444.cpp(59) : error C2065: “hInst”: 未声明的标识符