当前位置: 代码迷 >> C语言 >> [求助]怎么样使用int 33h中断显示鼠标?
  详细解决方案

[求助]怎么样使用int 33h中断显示鼠标?

热度:269   发布时间:2007-07-26 16:35:42.0
[求助]怎么样使用int 33h中断显示鼠标?
问题如上,帮忙编个简单的
搜索更多相关的解决方案: 鼠标  int  

----------------解决方案--------------------------------------------------------

#include <dos.h>
#include <stdio.h>
#define MOUSE_INT 0x33
#define MOUSE_RESET 0x00
#define MOUSE_SHOW 0x01
#define MOUSE_HIDE 0x02
#define MOUSE_BUTT_POS 0x03
#define MOUSE_SET_SENSITIVITY 0x1A
#define MOUSE_MOTION_REL 0x0B
#define MOUSE_LEFT_BUTTON 0x01
#define MOUSE_RIGHT_BUTTON 0x02
#define MOUSE_CENTER_BUTTON 0x04

int Squeeze_Mouse(int command,int *x,int *y,int *buttons)
{
union REGS inregs,outregs;

switch(command)
{
case MOUSE_RESET:
{
inregs.x.ax=0x00;
int86(MOUSE_INT,&inregs,&outregs);
*buttons=outregs.x.bx;
return(outregs.x.ax);
}break;

case MOUSE_SHOW:
{
inregs.x.ax=0x01;
int86(MOUSE_INT,&inregs,&outregs);
return(1);
}break;


case MOUSE_HIDE:
{
inregs.x.ax=0x02;
int86(MOUSE_INT,&inregs,&outregs);
return(1);
}break;


case MOUSE_BUTT_POS:
{
inregs.x.ax=0x03;
int86(MOUSE_INT,&inregs,&outregs);
*x=outregs.x.cx;
*y=outregs.x.dx;
*buttons=outregs.x.bx;
return(1);
}break;


case MOUSE_MOTION_REL:
{
inregs.x.ax=0x03;
int86(MOUSE_INT,&inregs,&outregs);
*x=outregs.x.cx;
*y=outregs.x.dx;
return(1);
}break;

case MOUSE_SET_SENSITIVITY:
{
inregs.x.ax=0x04;

inregs.x.bx=*buttons;
inregs.x.cx=*x;
inregs.x.dx=*y;

int86(MOUSE_INT,&inregs,&outregs);
return(1);
}break;


default:break;
}
}


void main(void)
{
int xmouse,ymouse,btnmouse,done=0,old=0,i=0;
Squeeze_Mouse(MOUSE_RESET,0,0,0);
Squeeze_Mouse(MOUSE_SHOW,0,0,0);
while(done==0)
{
Squeeze_Mouse(MOUSE_BUTT_POS,&xmouse,&ymouse,&btnmouse);
if(btnmouse==1&&old!=1)
{
old=1;
Squeeze_Mouse(MOUSE_HIDE,0,0,0);
printf("x=%d,y=%d,button=%d\n",xmouse,ymouse,btnmouse);
Squeeze_Mouse(MOUSE_SHOW,0,0,0);
}
if(btnmouse==2&&old!=2)
{
old=2;
Squeeze_Mouse(MOUSE_HIDE,0,0,0);
printf("x=%d,y=%d,button=%d\n",xmouse,ymouse,btnmouse);
Squeeze_Mouse(MOUSE_SHOW,0,0,0);
}
i++;
if(i==5000)
{
old=0;
i=0;
}
if(kbhit())
done=1;
}

}


----------------解决方案--------------------------------------------------------
可以参照这个:http://bbs.bc-cn.net/viewthread.php?tid=157151
----------------解决方案--------------------------------------------------------
anlogo那个怎么不行?
----------------解决方案--------------------------------------------------------
怎么说anlogo那个不行呢?我也试过,可以通过啊~他那个是没有绘制鼠标功能的,别以为没鼠标出现就不行哦...
----------------解决方案--------------------------------------------------------
  相关解决方案