6/24/10

Colour alteration in the client area

Buzz It
#include
# define ID_TIMER 1;
long _stdcall p1(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 =p1;
a.lpszClassName ="center";
RegisterClass (&a);
h=CreateWindow ("center","press",WS_OVERLAPPEDWINDOWWS_VSCROLL,300,400,490,380,0,0,i,0);
ShowWindow (h,l);
while(GetMessage (&m,0,0,0))
{
DispatchMessage (&m);
}
return 0;
}
long _stdcall p1(HWND w,UINT x,UINT y,long z)
{
HBRUSH hb;
static BOOL flipflop=false;
HDC d;
PAINTSTRUCT ps;
RECT rs;
HFONT hf;
static int p=300,r,q=300;
switch(x)
{
case WM_CREATE:
hf=CreateFont(75,50,0,0,1,0,0,0,8,0,0,0,0,"arial");
SetTimer (w,1,1000,NULL);
return 0;
case WM_TIMER:
p=p-100;
q=q-100;
r=r-50;
InvalidateRect(w,NULL,TRUE);
return 0;
case WM_PAINT:
d=BeginPaint (w,&ps);
GetClientRect (w,&rs);
hb=CreateSolidBrush (RGB(p,q,r));
FillRect (d,&rs,hb);
EndPaint (w,&ps);
DeleteObject (hb);
return 0;
case WM_DESTROY:
PostQuitMessage (0);
break;
default:
return DefWindowProc (w,x,y,z);
}
return 0;
}



Output

0 comments:

Post a Comment