资源描述:
《鼠标操作源代码》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、C语言鼠标操作方法及源码(转载) (2009-08-1214:05:40)转载标签: 杂谈分类: 网摘2008-05-0400:54 #include#include#include#include#include#include#defineWAITING0xff00#defineLEFTPRESS0xff01#defineLEFTCLICK0xff10#defineLEFTDRAG0xff19#defineRIGHTPRESS0xff02#defineRIGHTC
2、LICK0xff20#defineRIGHTDRAG0xff2a#defineMIDDLEPRESS0xff04#defineMIDDLECLICK0xff40#defineMIDDLEDRAG0xff4c#defineMOUSEMOVE0xff08inthide[16][16],bury[16][16],mousedraw[16][16],pixelsave[16][16];intmousebutton,mouseexist,mouseX,mouseY;voidmousepicture(){ inti,j,k; longhidenum[16]={ 0xe3c7,0x
3、c183,0x8001,0x0000, 0x0000,0x0000,0x0000,0x8001, 0x8001,0xc003,0xe007,0xf00f, 0xf81f,0xfc3f,0xfe7f,0xffff,};longburynum[16]={0x1c38,0x3e7c,0x7ffe,0xffff,0xffff,0xffff,0xffff,0x7ffe,0x3ffe,0x3ffc,0x1ff8,0x0ff0,0x07e0,0x03c0,0x0180,0x0000,};for(i=0;i<16;i++){ while(hidenum[i]!=0) {
4、 for(j=15;j>=0;j--) { hide[i][j]=hidenum[i]%2; hidenum[i]/=2; } } while(burynum[i]!=0) { for(k=15;k>=0;k--) { bury[i][j]=burynum[i]%2; burynum[i]/=2; } } for(k=0;k<16;k++) { if(hide[i][k]==0&&bury[i][k]==0) mousedraw[i][k]
5、=1; elseif(hide[i][k]==0&&bury[i][k]==1) mousedraw[i][k]=2; elseif(hide[i][k]==1&&bury[i][k]==0) mousedraw[i][k]=3; else mousedraw[i][k]=4; }}}voidmouseon(intx,inty){inti,j;for(i=0;i<16;i++){for(j=0;j<16;j++){pixelsave[i][j]=getpixel(x+j,y+i);if(mousedraw[i][j
6、]==1)putpixel(x+j,y+i,6);if(mousedraw[i][j]==2)putpixel(x+j,y+i,6);}}}voidmouseoff(){inti,j,x,y,color;x=mouseX;y=mouseY;for(i=0;i<16;i++){for(j=0;j<16;j++){if((mousedraw[i][j]==3)
7、
8、(mousedraw[i][j]==4))continue;putpixel(x+j,y+i,BLACK);putpixel(x+j,y+i,pixelsave[i][j]);}}}voidmouseload(){_AX=0
9、x00;geninterrupt(0x33);mouseexist=_AX;mousebutton=_BX;}voidmousereset(){_AX=0x00;geninterrupt(0x33);} voidmousesetX(intlx,intrx){_CX=lx;_DX=rx;_AX=0x07;geninterrupt(0x33);}voidmousesetY(intuy,intdy){_CX=uy;_DX=dy;_AX=0x08;geninterrupt(0x33);}