long _stdcall p2(HWND,UINT,UINT,long);
WNDCLASS a;
int _stdcall WinMain(HINSTANCE i,HINSTANCE j,char *k,int l)
{
HWND h;
MSG m;
a.style =CS_HREDRAWCS_VREDRAW;
a.hbrBackground =(HBRUSH)GetStockObject(WHITE_BRUSH);
a.hCursor =LoadCursor (0,IDC_ARROW);
a.hInstance =i;
a.lpfnWndProc =p2;
a.lpszClassName ="center";
RegisterClass (&a);
h=CreateWindow ("center","press",WS_OVERLAPPEDWINDOW,300,400,500,380,0,0,i,0);
ShowWindow (h,l);
while(GetMessage (&m,0,0,0))
{
DispatchMessage (&m);
}
return 0;
}
long _stdcall p2(HWND w,UINT x,UINT y,long z)
{
HDC d;
static int x1,y1;
switch(x)
{
case WM_LBUTTONDOWN:
x1=LOWORD(z);
y1=HIWORD(z);
d=GetDC (w);
TextOut (d,x1,y1,"click",4);
ReleaseDC (w,d);
break;
case WM_DESTROY:
PostQuitMessage (0);
break;
default:
return DefWindowProc (w,x,y,z);
}
return 0;
}
OUTPUT
0 comments:
Post a Comment