Evil code
程序代码:#include <windows.h>
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
int xScrn;
int yScrn;
HDC hScrnDC;
HDC hMaskDC;
HBITMAP hMaskBmp;
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShowCmd)
{
static TCHAR szAppName[]=TEXT("Snow");
HWND hwnd;
MSG msg;
WNDCLASS wndclass ;
wndclass.style =CS_HREDRAW|CS_VREDRAW;
wndclass.lpfnWndProc =WndProc;
wndclass.cbClsExtra =0;
wndclass.cbWndExtra =0;
wndclass.hInstance =hInstance;
wndclass.hIcon =LoadIcon(NULL,IDI_APPLICATION);
wndclass.hCursor =LoadCursor(NULL,IDC_IBEAM);
wndclass.hbrBackground =(HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName =NULL;
wndclass.lpszClassName =szAppName;
if (!RegisterClass(&wndclass))
{
MessageBox(NULL,TEXT("This program requires Windows NT!"),szAppName,MB_ICONERROR) ;
return 0 ;
}
hwnd=CreateWindow(szAppName,
TEXT("Snow"),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL);
ShowWindow(hwnd,SW_HIDE);
UpdateWindow(hwnd);
while (GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
switch(message)
{
case WM_CREATE:
{
SetTimer(hwnd,1,50,NULL);
hScrnDC = CreateDC("DISPLAY",NULL,NULL,NULL);
xScrn = GetDeviceCaps(hScrnDC,HORZRES);
yScrn = GetDeviceCaps(hScrnDC,VERTRES);
hMaskDC = CreateCompatibleDC(hScrnDC);
hMaskBmp = CreateCompatibleBitmap(hScrnDC,xScrn,yScrn);
SelectObject(hMaskDC,hMaskBmp);
BitBlt(hMaskDC,0,0,xScrn,yScrn,hScrnDC,0,0,SRCCOPY);
return 0;
}
case WM_TIMER:
{
BitBlt(hScrnDC,0,0,xScrn,yScrn,hMaskDC,0,0,SRCCOPY);
return 0;
}
case WM_DESTROY:
{
KillTimer(hwnd,1);
DeleteDC(hScrnDC);
DeleteDC(hMaskDC);
DeleteObject(hMaskBmp);
PostQuitMessage(0);
return 0;
}
}
return DefWindowProc(hwnd,message,wParam,lParam);
}









