为什么我包含了wingdi.h还是说有些未定义啊!

我的程序如下,,只有几十行#include"windows.h"#include"resource.h"#include"wingdi.h"#include"winuse... 我的程序如下,,只有几十行
#include"windows.h"
#include"resource.h"
#include"wingdi.h"
#include"winuser.h"
#include"mmsystem.h"
#pragma comment(lib,"winmm.lib")
#pragma comment(lib,"user32.lib")
#pragma comment(lib,"gdi32.lib")
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR,int);
//////////////////////////////////////////////////////
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdline,int nCmdShow)
{
WNDCLASS wcApp;
HWND ghWnd=NULL;
MSG msg;
char* szAppName="windows api application";
char* szAppTitle="windows api 窗口程序";

wcApp.style=CS_HREDRAW;
wcApp.lpfnWndProc=WndProc;
wcApp.cbWndExtra=0;
wcApp.cbClsExtra=0;
wcApp.hInstance=hInstance;
wcApp.hIcon=LoadIcon(hInstance,MAKEINTRESOURCE(IDI_ICON1));
wcApp.hCursor=LoadIcon(hInstance,MAKEINTRESOURCE(IDC_CURSOR1));
wcApp.hbrBackground=(HBRUSH)COLOR_WINDOW;
wcApp.lpszMenuName=NULL;
wcApp.lpszClassName=szAppName;

RegisterClass(&wcApp);
ghWnd=CreateWindow(szAppName,szAppTitle,WS_OVERLAPPEDWINDOW,100,100,350,300,NULL,NULL,hInstance,NULL);
if(NULL==ghWnd)
return 0;
ShowWindow(ghWnd,nCmdShow);
UpdateWindow(ghWnd);

while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}

//////////////////////////////////////////////////
LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{LPCSTR lpszCreate="建立窗口";
LPCSTR lpszDestroy="窗口关闭";
LPCSTR lpszCaption="受到消息";
LPCSTR lpszLBTN="鼠标左键按下";
LPCSTR lpszExit="要退出么?";

switch(message)
{
case WM_LBUTTONDOWN:
HDC hdc;
PAINSTRUCT ps;
hdc=BeginPaint(hwnd,&ps);
RECT rBG;
GetClientRect(hwnd,&rBG);
HBRUSH hbrBG=(HBRUSH)GetStockObject(WHITE_BRUSH);
FillRect(hdc,&rBG,hbrBG);
DeleteObject(hbrGB);
////////////////////////
LOGFONT lf={0};
lf.lfHeight=80;
lf.lfWeight=800;
lf.lfWidth=60;
lf.lfCharSet=DEFAULT_CHARSET;
strcpy(lf.lfFaceName,"黑体");
HFONT hFont=CreateFontIndirect(&lf);
HFONT hFontOld=(HFONT)SelectObject(hdc,hFont);
TextOut(hdc,100,30,szAppTitle,strlen(szAppTitle));
SelectObject(hdc,hFontOld);
DeleteObject(hFont);

EndPaint(hwnd,&ps);
break;
case WM_KEYDOWN:
if(wParam==VK_ESCAPE)
SendMessage(hwnd,WM_CLOSE,NULL,NULL);
break;
case WM_CLOSE:
if( MessageBox(NULL,lpszExit,lpszCaption,MB_YESNO|MB_DEFBUTTON2|MB_ICONASTERISK)==IDYES)
{DestroyWindow(hwnd);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,message,wParam,lParam);
}
return FALSE;
}

警告说:c:\program files\microsoft visual studio\myprojects\game01\game01.cpp(62) : error C2065: 'PAINSTRUCT' : undeclared identifier
c:\program files\microsoft visual studio\myprojects\game01\game01.cpp(62) : error C2146: syntax error : missing ';' before identifier 'ps'
还有好多这样的报错
展开
 我来答
dukang9904455
2010-04-14 · TA获得超过811个赞
知道小有建树答主
回答量:1028
采纳率:0%
帮助的人:966万
展开全部
是PAINTSTRUCT 而不是PAINSTRUCT
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式