6/8/10

/*simple window*/

Buzz It
#include
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,x2;
PAINTSTRUCT ps;
RECT r;
switch(x)
{
case WM_SIZE:
x1=LOWORD(z);
x2=HIWORD(z);
return 0;
case WM_PAINT:
d=BeginPaint(w,&ps);
GetClientRect (w,&r);
TextOut(d,(x1/2)-100,(x2/2),"welcome to vc++",15);
EndPaint(w,&ps);
break;
case WM_DESTROY:
PostQuitMessage (0);
break;
default:
return DefWindowProc (w,x,y,z);
}
return 0;
}
OUTPUT






0 comments:

Post a Comment