| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 321 人关注过本帖, 1 人收藏
标题:一个好玩的win 32 程序!!!!!!!!!!!!!!!!!
只看楼主 加入收藏
zanzan1986
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:100
专家分:140
注 册:2011-2-22
结帖率:66.67%
收藏(1)
已结贴  问题点数:20 回复次数:2 
一个好玩的win 32 程序!!!!!!!!!!!!!!!!!
#include "stdafx.h"
//#include<windows.h>
//如果有错误将上面的注释取消
#define NUM 300

int main(int argc, char* argv[])
{
     // TODO: Place code here.
    static int iKeep[NUM][4];
    HDC hdcScr, hdcMem;
    int cx,cy;
    HBITMAP hBitmap;
    HWND hWnd;
    int i,j,x1,y1,x2,y2;
    //MSG msg;
    //HACCEL hAccelTable;
    if(LockWindowUpdate(hWnd = GetDesktopWindow()))                                      //将所有窗口的更新锁定
    {
        hdcScr   =     GetDCEx(hWnd,NULL,DCX_CACHE | DCX_LOCKWINDOWUPDATE);              //获得屏幕的设备
        hdcMem   =     CreateCompatibleDC(hdcScr);                                       //创建一个屏幕设备
        cx       =     GetSystemMetrics(SM_CXSCREEN)/10;                                 //取得屏幕的宽的10之1
        cy       =     GetSystemMetrics(SM_CYSCREEN)/10;                                 //取得屏幕的高的10之1
        hBitmap  =     CreateCompatibleBitmap(hdcScr,cx,cy);
        SelectObject(hdcMem,hBitmap);                                                    //创建一个位图
        srand((int)GetCurrentTime());                                                    //取得时间
        for(i = 0; i < 2; i++)
        for(j = 0; j < NUM; j++)
        {
            if(i == 0)
            {
                iKeep[j][0] = x1 = cx * (rand()%10);
                iKeep[j][1] = y1 = cy * (rand()%10);
                iKeep[j][2] = x2 = cx * (rand()%10);
                iKeep[j][3] = y2 = cy * (rand()%10);
            }
            else
            {
                x1 = iKeep[NUM - 1 - j][0];
                y1 = iKeep[NUM - 1 - j][1];
                x2 = iKeep[NUM - 1 - j][2];
                y1 = iKeep[NUM - 1 - j][3];

            }
            BitBlt(hdcMem,0,0,cx,cy,hdcScr,x1,y1,SRCCOPY);                             //将屏幕上的图像复制到自创的设备上
            BitBlt(hdcScr,x1,y1,cx,cy,hdcScr,x2,y2,SRCCOPY);                           //将屏幕上的图像复制到自身屏幕上
            BitBlt(hdcScr,x2,y2,cx,cy,hdcScr,0,0,SRCCOPY);                             //同上
            Sleep(10);
        }
    DeleteDC(hdcMem);
    ReleaseDC(hWnd,hdcScr);
    DeleteObject(hBitmap);
    LockWindowUpdate(NULL);                                                            //解除屏幕锁定
    }
    return 0;
}
2011-09-05 22:31
czsbc
Rank: 10Rank: 10Rank: 10
等 级:青峰侠
帖 子:469
专家分:1700
注 册:2008-12-13
收藏
得分:10 
到处贴图
2011-09-05 22:46
凌烟
Rank: 2
等 级:论坛游民
帖 子:30
专家分:41
注 册:2011-1-10
收藏
得分:10 
有意思,好好研究下,呵呵
2011-09-05 23:01
快速回复:一个好玩的win 32 程序!!!!!!!!!!!!!!!!!
数据加载中...
 
   



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

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