#include"winuser.h"
#include"stdio.h"
#include"windows.h"LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // pointer to command line
int nCmdShow // show state of window
)
{
WNDCLASS wndclass;
wndclass.cbClsExtra=0;
wndclass.cbWndExtra=0;
wndclass.hbrBackgrourd=(HBRUSH)GetStockObject(BLACK_BRUSH);
wndclass.style=CS_VREDRAW|CS_HREDRAW;
wndclass.hIcon=LoadIcon(NULL,IDI_ERROR);
wndclass.hCursor=LoadCursor(NULL,IDC_CROSS);
wndclass.hInstance=Instance;
wndclass.wndProc=WinSonProc;
wndclass.lpszClassName="lesson1";
wndclass.lpszMenuName=NULL;
Register(&wndclass);
HWND hwnd;
hwnd=CreateWindow("lesson1","yanglinwei",WS_OVERLAPPEDWINDOW,0,0,500,600,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,SW_SHOWNORMAL);
UpdateWindow(hwnd);
MSG msg;
while(GetMessage(&msg,hwnd,0,0))
{ TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
)
{
switch(uMsg)
{
case WM_CHAR:
char szChar[20];
sprintf(szChar,"char is %d",wParam);
MessageBox(hwnd,szChar,"lesson1",0);
break;
case WM_LBUTTONDOWN:
MessageBox(hwnd,"mouse click","lesson1",0);
HDC hdc;
hdc=GetDC(hwnd);
TextOut(hdc,20,40,"i love you",strlen("i love you"));
Release(hwnd,hdc);
break;
case WM_PAINT:
HDC hdc;
PAINTSTUCT ps;
hdc=BeginPaint(hwnd,&ps);
TextOut(hdc,30,40,"i love you",strlen("i love you"));
EndPaint(hwnd,&ps);
break;
case WM_CLOSE:
if(IDYES==MessageBox(hwdn,"是否真的关闭?","yanglinwei",MB_YESNO))
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
return 0;
}f:\cyuyanyu\vc++英文版\[大家网]visual.c++.6.en[www.topsage.com]\vc98\include\winuser.h(39) : error C2146: syntax error : missing ';' before identifier 'HDWP'
f:\cyuyanyu\vc++英文版\[大家网]visual.c++.6.en[www.topsage.com]\vc98\include\winuser.h(39) : fatal error C1004: unexpected end of file found下面是winuser.h中的一段代码
#include <stdarg.h>
#ifndef NOUSERtypedef HANDLE HDWP; (以上两个错误都指向这一行)
typedef VOID MENUTEMPLATEA;
typedef VOID MENUTEMPLATEW;
#ifdef UNICODE
typedef MENUTEMPLATEW MENUTEMPLATE;
#else
typedef MENUTEMPLATEA MENUTEMPLATE;
#endif // UNICODE
找不出原因,请大家帮帮忙
不知道是不是你的路径太深了?
f:\cyuyanyu\vc++英文版\[大家网]visual.c++.6.en[www.topsage.com]\vc98\include\winuser.h
是找另外的机器试试
#include <winuser.h>//放这里