| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 343 人关注过本帖
标题:Evil code
只看楼主 加入收藏
longlong89
Rank: 11Rank: 11Rank: 11Rank: 11
来 自:广州
等 级:小飞侠
威 望:6
帖 子:1043
专家分:2754
注 册:2009-8-18
结帖率:100%
收藏
 问题点数:0 回复次数:2 
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);
}
2010-12-22 18:33
longlong89
Rank: 11Rank: 11Rank: 11Rank: 11
来 自:广州
等 级:小飞侠
威 望:6
帖 子:1043
专家分:2754
注 册:2009-8-18
收藏
得分:0 

想象力征服世界
2010-12-22 18:34
longlong89
Rank: 11Rank: 11Rank: 11Rank: 11
来 自:广州
等 级:小飞侠
威 望:6
帖 子:1043
专家分:2754
注 册:2009-8-18
收藏
得分:0 
哦 忘了说 Run

想象力征服世界
2010-12-22 18:35
快速回复:Evil code
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016918 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved