在DOS下鼠标显示技术的几个问题。
(1)该如何实时显示鼠标的移动?
(2)应该怎样画出一个普通鼠标的形状?
(3)应该怎样控制鼠标的显示与不显示?
谢谢!
开发工具:Borland c++ fos dos
21 个解决方案
dos下的图形鼠标不是画出来的,如果你的显示模式是图形模式,那么多数驱动程序显示的都是小箭头而不是色块,那个色块是在程序中自己设定的
利用gettext(x1,y1,x2,y2,*buffer)可以读出一个文本块的文字信息可每个文字的前景色和背景色,
你只需读出一个字符的位置,然后把前景色和背景色取反,利用
outtext(x1.y1.x2.y2.*buffer)写回去,
当鼠标移动时再把当前位置改回来,再写别的坐标就可以了
欢迎来我的个人主页: www.iYushan.com
有关的中断我都知道,问题是你们有没有这方面的例子给我参考一下?谢谢
这是很早以前在dos下用watcom c和汇编写的有关鼠标驱动的一段代码,接管了int33,实现会图形方式下鼠标的绝大多数功能,希望你能够看懂。
#include <dos.h>
#include <i86.h>
#include <stddef.h>
#include <bios.h>
#include <graph.h>
#define call_mouse int386(0x33,&inreg,&outreg)
#define EVENTMASK 0x54
#define lower(x,y) (x<y)?x:y
#define upper(x,y) (x>y)?x:y
#define ButtonL 0
#define ButtonR 1
#define ButtonM 2
#define SOFTWARE 0
#define HARDWARE 1
#define FALSE 0
#define TRUE 1
#define OFF 0
#define ON 1
struct Mresult { int present,buttons ; };
struct Mstatus { int button_status,button_count,xaxis,yaxis; };
struct Mresult *initMouse();
void Mshow(int showstat);
struct Mstatus Mpos();
void Mmoveto(int xaxis,int yaxis);
struct Mstatus Mpressed(int button);
struct Mstatus Mreleased(int button);
void Mxlimit(int min_x,int max_x);
void Mylimit(int min_y,int max_y);
void SetArrowCursor(void);
void SetEditCursor(void);
void Set_Cursor(unsigned char now_CURSOR_[14][9]);
int TPos(int TP,int Low,int High);
struct Mstatus Position;
struct Mresult *Result;
extern unsigned char _VGAPage;
extern unsigned char _VGAGran;
extern unsigned short vColor;
extern unsigned short _bytesPerLine;
extern unsigned int _A0000;
extern short maxxScreen;
extern short maxyScreen;
extern unsigned int videoMemoryMulTable[768];
static unsigned char _CURSOR_BUFF_[14][9];
static unsigned char _CURSOR_[14][9];
static unsigned short mx,my;
static unsigned short mi,mj;
static unsigned short M_ES;
static unsigned int M_EDX;
static unsigned char Mview;
static unsigned int haveMouse;
static unsigned char _ARROW_1_[14][9] =
{{0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, //1
{0x08,0x0F,0x08,0x00,0x00,0x00,0x00,0x00,0x00}, //2
{0x08,0x0F,0x0F,0x08,0x00,0x00,0x00,0x00,0x00}, //3
{0x08,0x0F,0x0F,0x0F,0x08,0x00,0x00,0x00,0x00}, //4
{0x08,0x0F,0x0F,0x0F,0x0F,0x08,0x00,0x00,0x00}, //5
{0x08,0x0F,0x0F,0x0F,0x0F,0x0F,0x08,0x00,0x00}, //6
{0x08,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x08,0x00}, //7
{0x08,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x08}, //8
{0x08,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x08}, //9
{0x08,0x0F,0x0F,0x0F,0x0F,0x0F,0x08,0x08,0x00}, //10
{0x00,0x08,0x08,0x08,0x0F,0x0F,0x08,0x00,0x00}, //11
{0x00,0x00,0x00,0x00,0x08,0x0F,0x0F,0x08,0x00}, //12
{0x00,0x00,0x00,0x00,0x08,0x0F,0x0F,0x08,0x00}, //13
{0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x00,0x00} //14
};
static unsigned char _EDIT_CURSOR_[14][9] =
{{0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00}, //1
{0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, //2
{0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, //3
{0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, //4
{0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, //5
{0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, //6
{0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, //7
{0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, //8
{0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, //9
{0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, //10
{0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, //11
{0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, //12
{0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, //13
{0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00} //14
};
void mPutPixel256(unsigned short x,unsigned short y, unsigned short color);
#pragma aux mPutPixel256=\
"mul word ptr _bytesPerLine"\
"add ax,bx"\
"adc dx,0"\
"movzx eax,ax"\
"cmp dl,byte ptr _VGAPage"\
"je short L1"\
"mov byte ptr _VGAPage,dl"\
"push eax"\
"push ecx"\
"mov cl,byte ptr _VGAGran"\
"shl dl,cl"\
"xor dh,dh"\
"mov ax,4f05H"\
"xor bx,bx"\
"int 10H"\
"pop ecx"\
"pop eax"\
"L1:"\
"add eax,dword ptr _A0000"\
"mov byte ptr [eax],cl"\
parm [BX] [AX] [CX]
unsigned short mGetPixel256(unsigned short x,unsigned short y);
#pragma aux mGetPixel256=\
"mul word ptr _bytesPerLine"\
"add ax,bx"\
"adc dx,0"\
"movzx eax,ax"\
"cmp dl,byte ptr _VGAPage"\
"je short L1"\
"mov byte ptr _VGAPage,dl"\
"push eax"\
"push ecx"\
"mov cl,byte ptr _VGAGran"\
"shl dl,cl"\
"xor dh,dh"\
"mov ax,4f05H"\
"xor bx,bx"\
"int 10H"\
"pop ecx"\
"pop eax"\
"L1:"\
"add eax,dword ptr _A0000"\
"mov cl,byte ptr [eax]"\
parm [BX] [AX] [CX]\
value [CX]
struct _M_E_ {
int rightButtonDown;
int leftButtonDown;
int rightButtonUp;
int leftButtonUp;
int mouseMove;
unsigned short mouseEvent;
unsigned short nowX;
unsigned short nowY;
unsigned short oldX;
unsigned short oldY;
}_MOUSEEVENT_;
下面还有
#pragma off (check_stack)
void _loadds far mouseEvenProc256 (int max, int mbx, int mcx, int mdx,
int msi, int mdi)
{
#pragma aux mouseEvenProc256 parm [EAX] [EBX] [ECX] [EDX] [ESI] [EDI]
_MOUSEEVENT_.mouseEvent = (unsigned short)max;
_MOUSEEVENT_.nowX = (unsigned short) mcx;
_MOUSEEVENT_.nowY = (unsigned short) mdx;
if (_MOUSEEVENT_.mouseEvent& 1)
{
if(Mview==1)
{
my=_MOUSEEVENT_.oldY;
for(mi=0;mi<14;mi++)
{
mx=_MOUSEEVENT_.oldX;
for(mj=0;mj<9;mj++)
{
if(_CURSOR_[mi][mj]!=0)
{
if(mx>maxxScreen) break;
mPutPixel256(mx,my,_CURSOR_BUFF_[mi][mj]);
}
mx++;
}
my++;
}
my=_MOUSEEVENT_.nowY;
for(mi=0;mi<14;mi++)
{
mx=_MOUSEEVENT_.nowX;
for(mj=0;mj<9;mj++)
{
if(_CURSOR_[mi][mj]!=0)
{
if(mx>maxxScreen) break;
_CURSOR_BUFF_[mi][mj]=mGetPixel256(mx,my);
mPutPixel256(mx,my,_CURSOR_[mi][mj]);
}
mx++;
}
my++;
}
}
_MOUSEEVENT_.oldX = _MOUSEEVENT_.nowX;
_MOUSEEVENT_.oldY = _MOUSEEVENT_.nowY;
}
}
//char * mouseBuff;
void mouseEvenProcEnd256 (void)
{
vColor=256;
}
#pragma on (check_stack)
void mPutPixel16(unsigned short x,unsigned short y, unsigned short color);
#pragma aux mPutPixel16=\
"xor edx,edx"\
"mov dx,word ptr _bytesPerLine"\
"imul eax,edx"\
"add eax,ebx"\
"shr eax,3"\
"and bx,7"\
"xor bx,7"\
"push cx"\
"mov cx,bx"\
"mov dx,0x80"\
"shr dx,cl"\
"pop cx"\
"push dx"\
"xor ebx,ebx"\
"mov bx,ax"\
"shr eax,16"\
"mov dl,al"\
"cmp dl,byte ptr _VGAPage"\
"je short L1"\
"mov byte ptr _VGAPage,dl"\
"push ebx"\
"push ecx"\
"mov cl,byte ptr _VGAGran"\
"shl dl,cl"\
"xor dh,dh"\
"mov ax,4f05H"\
"xor bx,bx"\
"int 10H"\
"pop ecx"\
"pop ebx"\
"L1:"\
"mov edi,000A0000H"\
"add edi,ebx"\
"mov dx,03c4h"\
"mov al,2"\
"out dx,al"\
"mov byte ptr [edi],cl"\
parm [BX] [AX] [CX]
unsigned short mGetPixel16(unsigned short x,unsigned short y);
#pragma aux mGetPixel16=\
"mul word ptr _bytesPerLine"\
"add ax,bx"\
"adc dx,0"\
"xor ebx,ebx"\
"mov bx,ax"\
"cmp dl,byte ptr _VGAPage"\
"je short L1"\
"mov byte ptr _VGAPage,dl"\
"push ebx"\
"push ecx"\
"mov cl,byte ptr _VGAGran"\
"shl dl,cl"\
"xor dh,dh"\
"mov ax,4f05H"\
"xor bx,bx"\
"int 10H"\
"pop ecx"\
"pop ebx"\
"L1:"\
"mov eax,000A0000H"\
"add eax,ebx"\
"mov cl,byte ptr [eax]"\
parm [BX] [AX] [CX]\
value [CX]
下面还有
#pragma off (check_stack)
void _loadds far mouseEvenProc16 (int max, int mbx, int mcx, int mdx,
int msi, int mdi)
{
#pragma aux mouseEvenProc16 parm [EAX] [EBX] [ECX] [EDX] [ESI] [EDI]
_MOUSEEVENT_.mouseEvent = (unsigned short)max;
_MOUSEEVENT_.nowX = (unsigned short) mcx;
_MOUSEEVENT_.nowY = (unsigned short) mdx;
if (_MOUSEEVENT_.mouseEvent& 1)
{
if(Mview==1)
{
my=_MOUSEEVENT_.oldY;
for(mi=0;mi<14;mi++)
{
mx=_MOUSEEVENT_.oldX;
for(mj=0;mj<9;mj++)
{
if(_CURSOR_[mi][mj]!=0)
{
if(mx>maxxScreen) break;
mPutPixel16(mx,my,_CURSOR_BUFF_[mi][mj]);
}
mx++;
}
my++;
}
my=_MOUSEEVENT_.nowY;
for(mi=0;mi<14;mi++)
{
mx=_MOUSEEVENT_.nowX;
for(mj=0;mj<9;mj++)
{
if(_CURSOR_[mi][mj]!=0)
{
if(mx>maxxScreen) break;
_CURSOR_BUFF_[mi][mj]=mGetPixel16(mx,my);
mPutPixel16(mx,my,_CURSOR_[mi][mj]);
}
mx++;
}
my++;
}
}
_MOUSEEVENT_.oldX = _MOUSEEVENT_.nowX;
_MOUSEEVENT_.oldY = _MOUSEEVENT_.nowY;
}
}
void mouseEvenProcEnd16 (void)
{
vColor=16;
}
#pragma on (check_stack)
int TPos(int TP,int Low,int High)
{
return ((TP>=Low)&&(TP<=High));
}
void Mshow(int showstat)
{
int mX,mY;
if(!haveMouse) return;
if(showstat)
{
if(Mview==0)
{
if(vColor==256)
{
my=_MOUSEEVENT_.nowY;
for(mi=0;mi<14;mi++)
{
mx=_MOUSEEVENT_.nowX;
for(mj=0;mj<9;mj++)
{
if(_CURSOR_[mi][mj]!=0)
{
if(mx>maxxScreen) break;
_CURSOR_BUFF_[mi][mj]=mGetPixel256(mx,my);
mPutPixel256(mx,my,_CURSOR_[mi][mj]);
}
mx++;
}
my++;
}
}
else
{
my=_MOUSEEVENT_.nowY;
for(mi=0;mi<14;mi++)
{
mx=_MOUSEEVENT_.nowX;
for(mj=0;mj<9;mj++)
{
if(_CURSOR_[mi][mj]!=0)
{
if(mx>maxxScreen) break;
_CURSOR_BUFF_[mi][mj]=mGetPixel16(mx,my);
mPutPixel16(mx,my,_CURSOR_[mi][mj]);
}
mx++;
}
my++;
}
}
}
Mview++;
}
else
{
if(Mview==1)
{
if(vColor==256)
{
my=_MOUSEEVENT_.nowY;
for(mi=0;mi<14;mi++)
{
mx=_MOUSEEVENT_.nowX;
for(mj=0;mj<9;mj++)
{
if(_CURSOR_[mi][mj]!=0)
{
if(mx>maxxScreen) break;
mPutPixel256(_MOUSEEVENT_.nowX+mj,_MOUSEEVENT_.nowY+mi,_CURSOR_BUFF_[mi][mj]);
}
mx++;
}
my++;
}
}
else
{
my=_MOUSEEVENT_.nowY;
for(mi=0;mi<14;mi++)
{
mx=_MOUSEEVENT_.nowX;
for(mj=0;mj<9;mj++)
{
if(_CURSOR_[mi][mj]!=0)
{
if(mx>maxxScreen) break;
mPutPixel16(_MOUSEEVENT_.nowX+mj,_MOUSEEVENT_.nowY+mi,_CURSOR_BUFF_[mi][mj]);
}
mx++;
}
my++;
}
}
}
Mview--;
}
}
struct Mstatus Mpos()
{
static struct Mstatus m;
union REGS inreg,outreg;
if(haveMouse)
{
inreg.w.ax=3;
call_mouse;
m.button_status=outreg.w.bx;
m.xaxis=outreg.w.cx;
m.yaxis=outreg.w.dx;
}
else
m.button_status=0;
return(m);
}
void Mmoveto(int xaxis,int yaxis)
{
union REGS inreg,outreg;
inreg.w.ax=4;
inreg.w.cx=xaxis;
inreg.w.dx=yaxis;
call_mouse;
}
struct Mstatus Mpressed(int button)
{
static struct Mstatus m;
union REGS inreg,outreg;
if(haveMouse)
{
inreg.w.ax=5;
inreg.w.bx=button;
call_mouse;
m.button_status=outreg.w.ax;
m.button_count=outreg.w.bx;
m.xaxis=outreg.w.cx;
m.yaxis=outreg.w.dx;
}
else
m.button_count=0;
return(m);
}
struct Mstatus Mreleased(int button)
{
static struct Mstatus m;
union REGS inreg,outreg;
if(haveMouse)
{
inreg.w.ax=6;
inreg.w.bx=button;
call_mouse;
m.button_status=outreg.w.ax;
m.button_count=outreg.w.bx;
m.xaxis=outreg.w.cx;
m.yaxis=outreg.w.dx;
}
else
m.button_count=0;
return(m);
}
void Mxlimit(int min_x,int max_x)
{
union REGS inreg,outreg;
inreg.w.ax=7;
inreg.w.cx=min_x;
inreg.w.dx=max_x;
call_mouse;
}
void Mylimit(int min_y,int max_y)
{
union REGS inreg,outreg;
inreg.w.ax=8;
inreg.w.cx=min_y;
inreg.w.dx=max_y;
call_mouse;
}
void SetEditCursor(void)
{
Mshow(FALSE);
for(mi=0;mi<14;mi++)
for(mj=0;mj<9;mj++)
_CURSOR_[mi][mj]=_EDIT_CURSOR_[mi][mj];
Mshow(TRUE);
}
void SetArrowCursor(void)
{
Mshow(FALSE);
for(mi=0;mi<14;mi++)
for(mj=0;mj<9;mj++)
_CURSOR_[mi][mj]=_ARROW_1_[mi][mj];
Mshow(TRUE);
}
void Set_Cursor(unsigned char now_CURSOR_[14][9])
{
Mshow(FALSE);
for(mi=0;mi<14;mi++)
for(mj=0;mj<9;mj++)
_CURSOR_[mi][mj]=now_CURSOR_[mi][mj];
Mshow(TRUE);
}
int lock_region (void *address, unsigned length)
{
union REGS regs;
unsigned linear;
linear = (unsigned) address;
regs.w.ax = 0x600;
regs.w.bx = (unsigned short) (linear >> 16);
regs.w.cx = (unsigned short) (linear & 0xFFFF);
regs.w.si = (unsigned short) (length >> 16);
regs.w.di = (unsigned short) (length & 0xFFFF);
int386 (0x31, ®s, ®s);
return (! regs.w.cflag);
}
struct Mresult *initMouse()
{
static struct Mresult m;
void (far *function_ptr)();
struct SREGS sregs;
union REGS inreg,outreg;
segread(&sregs);
Mview=0;
inreg.w.ax=0;
call_mouse;
m.present=outreg.w.ax;
m.buttons=outreg.w.bx;
haveMouse=m.present;
if(m.present)
{
//初始化鼠标事件结构
_MOUSEEVENT_.oldX=maxxScreen/2;
_MOUSEEVENT_.oldY=maxyScreen/2;
_MOUSEEVENT_.nowX=maxxScreen/2;
_MOUSEEVENT_.nowY=maxyScreen/2;
_MOUSEEVENT_.mouseEvent=0;
_MOUSEEVENT_.rightButtonDown=FALSE;
_MOUSEEVENT_.rightButtonUp=FALSE;
_MOUSEEVENT_.leftButtonDown=FALSE;
_MOUSEEVENT_.leftButtonUp=FALSE;
_MOUSEEVENT_.mouseMove=FALSE;
Mview=0;
//锁定鼠标事件结构及鼠标事件过程
lock_region (&_MOUSEEVENT_, sizeof(_MOUSEEVENT_));
lock_region (&_CURSOR_BUFF_, sizeof(_CURSOR_BUFF_)*2+23);
if(vColor==256)
lock_region ((void near *) mouseEvenProc256,(char *) mouseEvenProcEnd256 - (char near *) mouseEvenProc256);
else
lock_region ((void near *) mouseEvenProc16,(char *) mouseEvenProcEnd16 - (char near *) mouseEvenProc16);
// Mshow(TRUE);
//设置X界限
inreg.w.ax = 0x7;
inreg.w.cx = 0;
inreg.w.dx = maxxScreen;
int386 (0x33, &inreg, &outreg);
//设置Y界限
inreg.w.ax = 0x8;
inreg.w.cx = 0;
inreg.w.dx = maxyScreen;
int386 (0x33, &inreg, &outreg);
//安装鼠标时件过程
inreg.w.ax = 0x0014;
inreg.w.cx = 0x0001;
if(vColor==256)
function_ptr = ( void(*)(void) ) mouseEvenProc256;
else
function_ptr = ( void(*)(void) ) mouseEvenProc16;
inreg.x.edx = FP_OFF (function_ptr);
sregs.es = FP_SEG (function_ptr);
int386x (0x33, &inreg, &outreg, &sregs);
M_ES = sregs.es;
M_EDX = outreg.x.edx;
for(mi=0;mi<14;mi++)
for(mj=0;mj<9;mj++)
_CURSOR_[mi][mj]=_ARROW_1_[mi][mj];
Mmoveto(_MOUSEEVENT_.nowX,_MOUSEEVENT_.nowY);
Mshow(TRUE);
}
return (&m);
}
void ExitMouse(void)
{
struct SREGS sregs;
union REGS inreg,outreg;
inreg.w.ax = 0x000C;
inreg.w.cx = 0;
inreg.x.edx = M_EDX;
sregs.es = M_ES;
int386x (0x33, &inreg, &outreg, &sregs);
inreg.w.ax=0;
call_mouse;
Mshow(FALSE);
}
完了
一大堆函数供你调用,不然你学C干什么,学汇编算了!
用int33 就可以直接显示出光标,在文本模式下是一个方块,在图形模式下是一个小箭头。
msshow()
{union REGS rg;
rg.x.ax=1;
int86(0x33,&rg,&rg);
}
msclose()
{union REGS rg;
rg.x.ax=0;
int86(0x33,&rg,&rg);
}
鼠标的形状是可以通过数组unsigned int temp[32]运算的,图形方式下,前16位元素与后
16位进行运算,具体是0和0显示背景色,0和1显示白色,1和1显示前景反转
比如工字型的
unsigned int gong[32]=
{/*屏幕*/
0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000
/* GUANGBIAO*/
0x0fff,0x0020,0x0020,0x0020,
0x0020,0x0020,0x0020,0x0020,
0x0020,0x0020,0x0020,0x0020,
0x0020,0x0020,0x0020,0x0fff
}
在通过9H调用可以显示了
to sans(sans) :我的确看不懂!编译后inreg.w.ax 要改为:inreg.x.ax;
int386(...)函数定义在哪?头文件i86.h在哪有?
我的程序用了其他中断,运行你的程序时会死机!我觉得不能接管了int33;
在DOS下鼠标是完全画出来的,就象在EDIT中的那个红色的小方块一样,就是用画图的方式画一小个的矩形,将里面涂满颜色就行了.知道了这个移动就是将原来那个擦了再在新的地方画上一个新的,不显示就将鼠标擦了就行了.
在DOS下鼠标是完全画出来的,就象在EDIT中的那个红色的小方块一样,就是用画图的方式画一小个的矩形,将里面涂满颜色就行了.知道了这个移动就是将原来那个擦了再在新的地方画上一个新的,不显示就将鼠标擦了就行了.
TC2.0源码:
#include <bios.h>
/*鼠标信息宏定义*/
#define WAITING 0xff00
#define LEFTPRESS 0xff01
#define LEFTCLICK 0xff10
#define LEFTDRAG 0xff19
#define RIGHTPRESS 0xff02
#define RIGHTCLICK 0xff20
#define RIGHTDRAG 0xff2a
#define MIDDLEPRESS 0xff04
#define MIDDLECLICK 0xff40
#define MIDDLEDRAG 0xff4c
#define MOUSEMOVE 0xff08
int Keystate;
int MouseExist;
int MouseButton;
int MouseX;
int MouseY;
/*鼠标光标形状定义*/
typedef struct
{
unsigned int shape[32];
char hotx;
char hoty;
}SHAPE;
/*手型1*/
SHAPE HAND1={
{
0xe1ff,0xe1ff,0xe1ff,0xe1ff,
0xe000,0xe000,0xe000,0xe000,
0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,
0x1e00,0x1200,0x1200,0x1200,
0x1200,0x13ff,0x1249,0x1249,
0x1249,0x9001,0x9001,0x8001,
0x8001,0x8001,0x8001,0xffff
},
5,0,
};
/*手型2*/
SHAPE HAND2={
{
0xf3ff,0xe1ff,0xe2ff,0xe1ff,
0xe001,0xe000,0xe000,0xe000,
0x8000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x8001,0x0003,
0x0c00,0x1200,0x1200,0x1200,
0x13fe,0x1249,0x1200,0x1249,
0x7249,0x9001,0x9001,0x9001,
0x8001,0x8001,0x4002,0x3ffc
},
4,0,
};
/*箭头型*/
SHAPE ARROW={
{
0x3fff,0x1fff,0x0fff,0x07ff,
0x03ff,0x01ff,0x00ff,0x007f,
0x003f,0x00ff,0x01ff,0x10ff,
0x30ff,0xf87f,0xf87f,0xfc3f,
0x0000,0x7c00,0x6000,0x7000,
0x7800,0x7c00,0x7e00,0x7f00,
0x7f80,0x7e00,0x7c00,0x4600,
0x0600,0x0300,0x0300,0x0180
},
0,0,
};
/*左右箭头型*/
SHAPE LEFTRIGHT={
{
0xffff,0xffff,0xfbdf,0xf3cf,
0xe3c7,0xc003,0x8001,0x0000,
0x8001,0xc003,0xe3c7,0xf3cf,
0xfbdf,0xffff,0xffff,0xffff,
0x0000,0x0000,0x0420,0x0c30,
0x1428,0x27e4,0x4002,0x8001,
0x4002,0x27e4,0x1428,0x0c30,
0x0420,0x0000,0x0000,0x0000
},
8,8,
};
/*上下箭头型*/
SHAPE UPDOWN={
{
0xfeff,0xfcff,0xf83f,0xf01f,
0xe00f,0xc00f,0xf83f,0xf83f,
0xf83f,0xf83f,0xc007,0xe00f,
0xf01f,0xf83f,0xfc7f,0xfeff,
0x0100,0x0280,0x0440,0x0820,
0x1010,0x3c78,0x0440,0x0440,
0x0440,0x0440,0x3c78,0x1010,
0x0820,0x0440,0x0280,0x0100
},
8,8,
};
/*鼠标光标显示*/
void MouseOn()
{
_AX=0x01;
geninterrupt(0x33);
}
/*鼠标光标掩示*/
void MouseOff()
{
_AX=0x02;
geninterrupt(0x33);
}
/*鼠标是否加载
MouseExist:1=加载
0=未加载
MouseButton:鼠标按键数目 */
void MouseLoad()
{
_AX=0x00;
geninterrupt(0x33);
MouseExist=_AX;
MouseButton=_BX;
}
/*鼠标状态值初始化*/
void MouseReset()
{
_AX=0x00;
geninterrupt(0x33);
}
/*改变鼠标光标形状
SHAPE sp:为以上定义的形状 */
void MouseShape(SHAPE sp)
{
_BX=sp.hotx;
_CX=sp.hoty;
_ES=FP_SEG(&sp.shape);
_DX=FP_OFF(&sp.shape);
_AX=0x09;
geninterrupt(0x33);
}
/*设置鼠标左右边界
lx:左边界
gx:右边界 */
void MouseSetX(int lx,int rx)
{
_CX=lx;
_DX=rx;
_AX=0x07;
geninterrupt(0x33);
}
/*设置鼠标上下边界
uy:上边界
dy:下边界 */
void MouseSetY(int uy,int dy)
{
_CX=uy;
_DX=dy;
_AX=0x08;
geninterrupt(0x33);
}
/*设置鼠标当前位置
x:横向坐标
y:纵向坐标 */
void MouseSetXY(int x,int y)
{
_CX=x;
_DX=y;
_AX=0x04;
geninterrupt(0x33);
}
/*设置鼠标速度(缺省值:vx=8,vy=1)
值越大速度越慢 */
void MouseSpeed(int vx,int vy)
{
_CX=vx;
_DX=vy;
_AX=0x0f;
geninterrupt(0x33);
}
/*获取鼠标按下键的信息*/
/*是否按下左键
返回值: 1=按下 0=释放*/
int LeftPress()
{
_AX=0x03;
geninterrupt(0x33);
return(_BX&1);
}
/*是否按下中键
返回值同上 */
int MiddlePress()
{
_AX=0x03;
geninterrupt(0x33);
return(_BX&4);
}
/*是否按下右键
返回值同上 */
int RightPress()
{
_AX=0x03;
geninterrupt(0x33);
return(_BX&2);
}
/*获取鼠标当前位置*/
void MouseGetXY()
{
_AX=0x03;
geninterrupt(0x33);
MouseX=_CX;
MouseY=_DX;
}
以上函数我都明白,关键是该如何动态识别鼠标的移动,比如说我应该采用什么循环来判别鼠标移动,按键,如果用键盘就可以用一个while(1)循环:
while(1)
{
int nkey=getch();
switch(nkey)
{
case ESC: return;
case ENTER: .....
break;
case SPACE: .....
break;
}
}
这样就可以判断按键情况,如果用鼠标,该怎样?还有应该怎样动态的更新鼠标移动的位置?
我说得不好,请大家见谅,请赐教!谢谢!
to kinghawk(雪鹰) :我这样调用你的程序:但屏幕什么显示都没有?为什么?应该怎样调用?谢谢!
void main()
{
// int graphdriver=VGA,graphmode=VGAHI;
// initgraph(&graphdriver,&graphmode,"");
MouseLoad();
MouseShape(ARROW);
MouseSetX(1,635);
MouseSetY(1,475);
MouseSetXY(100,100);
MouseShape(ARROW);
MouseSpeed(8,1);
MouseOn();
delay(5000);
MouseOff();
// closegraph();
// Mouse.h
// Use INT 33H to control mouse
#include "dos.h"
struct MousePos{
int x;
int y;
};
typedef struct MousePos MPOS;
int CheckMouse(void){ //check if mouse is installed
//return:0-No
// Not 0:number of buttons on mouse
REGS in,out;
in.x.ax=0;
int86(0x33,&in,&out);
if(out.x.ax)
return out.x.bx;
else
return 0;
}
void ShowMouseCursor(void){
REGS in,out;
in.x.ax=1;
int86(0x33,&in,&out);
return ;
}
void HideMouseCursor(void){
REGS in,out;
in.x.ax=2;
int86(0x33,&in,&out);
return;
}
int GetMouseStat(MPOS *p){ //call :ret=GetMouseStat(&MousePos)
//return :0-No button pushed
// 1-Left button
// 2-Right button
// 3-Both
// *p:postion of mouse,if the video mode is set to text mode,
// the real postion should be (x/8+1,y/8+1),
// and in graphic mode ,it is just the right postion.
REGS in,out;
in.x.ax=3;
int86(0x33,&in,&out);
p->x=out.x.cx;
p->y=out.x.dx;
return out.x.bx;
}
void SetMousePos(MPOS *p){
//in text mode,p->x=(x-1)*8,p->y=(y-1)*8 (convert to the mouse pos)
//in graphic mode ,that's not necessary
//return :nothing
REGS in,out;
in.x.ax=4;
in.x.cx=p->x;
in.x.dx=p->y;
int86(0x33,&in,&out);
return ;
}
int GetButtonPInfo(int but,int *stat,MPOS *p){
//entry :but-0:Left,1:Right,2:Middle
// stat(0~7):0:no button press
// 1:Left
// 2:Right
// 4:Middle
//return :count of button presses ,set to zero after call
// p.x-horizontal position at last press
// p.y-vertical position at last press
REGS in,out;
in.x.ax=5;
in.x.bx=but;
int86(0x33,&in,&out);
*stat=out.x.ax;
p->x=out.x.cx;
p->y=out.x.dx;
return out.x.bx;
}
//mouse.cpp
#include "mouse.h"
#include "dos.h"
#include "conio.h"
#include "stdio.h"
void main(void){
MPOS p,oldp;
int stat,oldstat;
clrscr();
ShowMouseCursor();
gotoxy(1,1);
oldstat=GetMouseStat(&oldp);
printf("Mouse status:%2d, mouse postion:(%2d,%2d)",oldstat,oldp.x/8+1,oldp.y/8+1);
while(!kbhit()){
stat=GetMouseStat(&p);
if(oldstat-stat){
gotoxy(14,1);printf("%2d",stat);
oldstat=stat;
}
if((p.x-oldp.x)||(p.y-oldp.y)){ //position changed
gotoxy(33,1);printf("%2d,%2d",p.x/8+1,p.y/8+1);
oldp.x=p.x;
oldp.y=p.y;
}
}
HideMouseCursor();
}
再转一篇,以示对holyfire的无限怀念...
好象从前有本求伯君的书<<新编深入DOS编程>>(?)对鼠标编程说得很详细,但是这的确是"老古董了".
============================================================
主 题:是否有一个函数可以随时检测键盘及鼠标是否有有输入,以便在连续运行过程中可以随时插入挂起和解挂。若有,则它的返回参数,输入参数是什么,检测时间有多长?
作 者:coolfancy
所属论坛:C/C++
问题点数:43
回复次数:5
发表时间:2001-4-6 11:39:00
回复贴子:
回复人:holyfire(烧不完的祖国爱,燃不尽的故乡情) (2001-4-6 11:56:00) 得0分
呵呵,这个问题好大
一般监测键盘使用kbhit();bioskey();
鼠标函数没有现成的,要自己编了,我可以提供一个抛砖引玉。
这是我以前编dos下小程序用的,老古董了,呵呵。
文件:Input.h
#ifndef _INPUT_H_
#define _INPUT_H_
#define USER_CURSOR -1
#define CLOCK_CURSOR 0
#define TEXT_CURSOR 1
#define RUN_CURSOR 2
#define PEN_CURSOR 3
#define CENT_CURSOR 4
#define BAR_CURSOR 5
#define BUSY_CURSOR 6
#define MouseDown 0x0001
#define MouseUp 0x0002
#define MouseAuto 0x0004
#define MouseDouble 0x0008
#define MouseDownR 0x0010
#define MouseUpR 0x0020
#define MouseAutoR 0x0040
#define MouseDoubleR 0x0080
#define MouseDownM 0x0100
#define MouseUpM 0x0200
#define MouseAutoM 0x0400
#define MouseDoubleM 0x0800
#define MouseMove 0x1000
#define evNothing 0x0000
#define evMouse 0x1fff
#define evButton 0x0fff
#define evKey 0x2000
#define evMessage 0x4000
#define mbLeftButton 0x01
#define mbRightButton 0x02
#define mbMiddleButton 0x04
#define RightShiftDown 0x01
#define LeftShiftDown 0x02
#define ShiftDown 0x03
#define CtrlDown 0x04
#define AltDown 0x08
#define ScrollOn 0x10
#define NumlockOn 0x20
#define CapsOn 0x40
#define Insert 0x80
#define DEL 339
#define INS 338
#define HOME 327
#define END 335
#define PGUP 329
#define PGDN 337
#define _UP 328
#define _DOWN 336
#define _LEFT 331
#define _RIGHT 333
#define _F1 315
#define _F2 316
#define _F3 317
#define _F4 318
#define _F5 319
#define _F6 320
#define _F7 321
#define _F8 322
#define _F9 323
#define _F10 324
#define SHIFTF1 340
#define SHIFTF2 341
#define SHIFTF3 342
#define SHIFTF4 343
#define SHIFTF5 344
#define SHIFTF6 345
#define SHIFTF7 346
#define SHIFTF8 347
#define SHIFTF9 348
#define SHIFTF10 349
#define CTRLF1 350
#define CTRLF2 351
#define CTRLF3 352
#define CTRLF4 353
#define CTRLF5 354
#define CTRLF6 355
#define CTRLF7 356
#define CTRLF8 357
#define CTRLF9 358
#define CTRLF10 359
#define ALTF1 360
#define ALTF2 361
#define ALTF3 362
#define ALTF4 363
#define ALTF5 364
#define ALTF6 365
#define ALTF7 366
#define ALTF8 367
#define ALTF9 368
#define ALTF10 369
#define ALT1 376
#define ALT2 377
#define ALT3 378
#define ALT4 379
#define ALT5 380
#define ALT6 381
#define ALT7 382
#define ALT8 383
#define ALT9 128
#define ALT0 129
#define ALTA 286
#define ALTB 304
#define ALTC 302
#define ALTD 288
#define ALTE 274
#define ALTF 289
#define ALTG 290
#define ALTH 291
#define ALTI 279
#define ALTJ 292
#define ALTK 293
#define ALTL 294
#define ALTM 306
#define ALTN 305
#define ALTO 280
#define ALTP 281
#define ALTQ 272
#define ALTR 275
#define ALTS 287
#define ALTT 276
#define ALTU 278
#define ALTV 303
#define ALTW 273
#define ALTX 301
#define ALTY 277
#define ALTZ 300
#define BACKUP 8
#define TAB 9
#define SHIFTTAB 271
#define ESC 27
#define ENTER 13
#define CTRLA 1
#define CTRLB 2
#define CTRLC 3
#define CTRLD 4
#define CTRLE 5
#define CTRLF 6
#define CTRLG 7
#define CTRLH 8
#define CTRLI 9
#define CTRLJ 10
#define CTRLK 11
#define CTRLL 12
#define CTRLM 13
#define CTRLN 14
#define CTRLO 15
#define CTRLP 16
#define CTRLQ 17
#define CTRLR 18
#define CTRLS 19
#define CTRLT 20
#define CTRLU 21
#define CTRLV 22
#define CTRLW 23
#define CTRLX 24
#define CTRLY 25
#define CTRLZ 26
#define CTRLEND 373
#define CTRLHOME 375
#define CTRLPGDN 374
#define CTRLPGUP 132
#define CTRLRIGHT 371
#define CTRLLEFT 132
struct MouseEvent {
unsigned char buttons;
int x,y;
int keystate;
} ;
struct MessageEvent {
unsigned command;
union {
void far *infoPtr;
long infoLong;
unsigned int infoWord;
int infoInt;
unsigned char infoByte[2];
char infoChar[2];
}e;
};
struct MouseState {
unsigned char buttons;
int x,y;
long time;
};
typedef struct event{
unsigned what;
unsigned ID;
union {
int key;
struct MessageEvent message;
struct MouseEvent mouse;
}e;
}Event,* PEvent;
void GetEvent(PEvent event);
void ClearEvent(PEvent event);
void PostMessage(PEvent event);
void ClearPostBox(PEvent event);
void GetMouseEvent(PEvent event);
void GetKeyEvent(PEvent event);
void GetMessageEvent(PEvent event);
struct MOUSE {
int OK;
int showState;
int max_X,max_Y;
int centre_X,centre_Y;
long lastDownTime,lastDownTimeR,lastDownTimeM;
int doubleInterval,autoInterval;
};
void Mouse_Set_Cursor(int x,int y,int type,unsigned int far parttern);
void Mouse_GetState(struct MouseState * state );
void Mouse_GetEvent(PEvent event);
void Mouse_Hide(void);
void Mouse_Show(void);
void Mouse_Get_Pos(int * x,int * y);
void Mouse_Put_Pos(int x,int y);
void Mouse_Put_Centre(void);
int Mouse_In_Box(int left,int top,int right,int bottom);
void Mouse_Set_Region(int left,int top,int right,int bottom);
void Mouse_Restore_Region(void);
void Mouse_Set_Speed(int n);
void Mouse_Set_DoubleTime(int n);
void Mouse_Set_AutoTime(int n);
int Mouse_Init(void);
#endif
文件:Mouse.c
#include <dos.h>
#include <bios.h>
#include <alloc.h>
#include "input.h"
struct MOUSE G_MOUSE;
struct MouseState lastMouse={0,0,0};
unsigned cursor[7][32] ={
{
0xe01f,0xe01f,0xe01f,0xc00f,0x8007,0x3,0x3,0x1,
0x3,0x3,0x8007,0xc00f,0xe01f,0xe01f,0xe01f,0xffff,
0x0,0xfc0,0xfc0,0x1020,0x2110,0x4108,0x4108,0x410c,
0x4208,0x4408,0x2010,0x1020,0xfc0,0xfc0,0x0,0x0
},
{
0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,
0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,
0x0,0x1c70,0x280,0x100,0x100,0x100,0x100,0x100,
0x100,0x100,0x100,0x7c0,0x100,0x280,0x1c70,0x0
},
{
0x8001,0x8001,0x8001,0x8001,0xc003,0xe007,0xf00f,0xf81f,
0xf81f,0xf00f,0xe007,0xc003,0x8001,0x8001,0x8001,0x8001,
0x0,0x3ffc,0x3ffc,0x2004,0x1008,0x810,0x420,0x240,
0x240,0x420,0x9d0,0x17e8,0x2ff4,0x3ffc,0x3ffc,0x0
},
{
0xffff,0xffff,0xfe1f,0xfe0f,
0xfd0f,0xfdcf,0xfbdf,0xfbbf,
0xf7bf,0xf77f,0xef7f,0xe6ff,
0xe0ff,0xe1ff,0xe3ff,0xefff,
0x0000,0x0000,0x01e0,0x01f0,
0x02f0,0x0230,0x0420,0x0440,
0x0840,0x0880,0x1080,0x1900,
0x1f00,0x1e00,0x1c00,0x1000
},
{
0xfeff,0xfeff,0xfeff,0xfeff,
0xfeff,0xfeff,0xfeff,0x0000,
0xfeff,0xfeff,0xfeff,0xfeff,
0xfeff,0xfeff,0xfeff,0xfeff,
0x0100,0x0100,0x0100,0x0100,
0x0100,0x0100,0x0100,0xffff,
0x0100,0x0100,0x0100,0x0100,
0x0100,0x0100,0x0100,0x0100
},
{
0xffff,0xffff,0xc003,0xdffb,
0xdffb,0xdffb,0xdffb,0xdffb,
0xdffb,0xdffb,0xdffb,0xdffb,
0xdffb,0xc003,0xffff,0xffff,
0x0000,0x0000,0x3ffc,0x2004,
0x2004,0x2004,0x2004,0x2004,
0x2004,0x2004,0x2004,0x2004,
0x2004,0x3ffc,0x0000,0x0000
}
};
void Mouse_Set_Cursor(int x,int y,int type,unsigned int far parttern)
{
union REGS ir;
struct SREGS isr;
ir.x.ax=9;
ir.x.bx=x;
ir.x.cx=y;
if(type==USER_CURSOR)
{
ir.x.dx=FP_OFF(parttern);
isr.es=FP_SEG(parttern);
}
else
{
ir.x.dx=FP_OFF(cursor[type]);
isr.es=FP_SEG(cursor[type]);
}
int86x(0x33,&ir,&ir,&isr);
}
void mouse_intr(int * m1,int * m2,int * m3,int * m4)
{
union REGS inregs, outregs;
inregs.x.ax=* m1;
inregs.x.bx=* m2;
inregs.x.cx=* m3;
inregs.x.dx=* m4;
int86(0x33,&inregs,&outregs);
* m1=outregs.x.ax;
* m2=outregs.x.bx;
* m3=outregs.x.cx;
* m4=outregs.x.dx;
}
void mouse_intrx(unsigned ax,unsigned bx,unsigned cx,unsigned dx,unsigned es)
{
struct REGPACK reg;
reg.r_ax=ax;
reg.r_bx=bx;
reg.r_cx=cx;
reg.r_dx=dx;
reg.r_es=es;
intr(0x33,®);
}
void GetKeyEvent(PEvent event)
{
int k,a,b;
if(bioskey(1)==0)
return;
k=bioskey(0);
a=k>>8;
b=k&0x00ff;
if(b==0)
k=256+a;
else
k=b;
event->what=evKey;
event->e.key=k;
}
void GetMouseEvent(PEvent event)
{
Mouse_GetEvent( event );
}
void GetEvent(PEvent event)
{
event->ID=-1;
event->what=evNothing;
if( G_MOUSE.OK )
GetMouseEvent(event);
if( event->what == evNothing )
GetKeyEvent(event);
}
void Mouse_GetState( struct MouseState * ms)
{
int m1=0x03,m2,m3,m4;
mouse_intr(&m1,&m2,&m3,&m4);
ms->buttons=m2;
ms->x=m3;
ms->y=m4;
ms->time=biostime(0,ms->time);
}
void Mouse_GetEvent(PEvent ev )
{
static int flag=1;
struct MouseState state;
Mouse_GetState(&state);
if(flag)
{
flag=0;
lastMouse=state;
}
if( state.buttons&mbLeftButton )
{
if( lastMouse.buttons&mbLeftButton )
{
if( state.time-G_MOUSE.lastDownTime>G_MOUSE.autoInterval )
ev->what ¦= MouseAuto;
}
else
{
if( (state.time-G_MOUSE.lastDownTime)<G_MOUSE.doubleInterval &&state.time>G_MOUSE.lastDownTime )
ev->what ¦= MouseDouble;
else
ev->what ¦= MouseDown;
G_MOUSE.lastDownTime=state.time;
}
}
else if(lastMouse.buttons&mbLeftButton )
ev->what ¦= MouseUp;
if( state.buttons&mbRightButton )
{
if( lastMouse.buttons&mbRightButton )
{
if( state.time-G_MOUSE.lastDownTimeR>G_MOUSE.autoInterval )
ev->what ¦= MouseAutoR;
}
else
{
if( (state.time-G_MOUSE.lastDownTimeR)<G_MOUSE.doubleInterval &&state.time>G_MOUSE.lastDownTimeR )
ev->what ¦= MouseDoubleR;
else
ev->what ¦= MouseDownR;
G_MOUSE.lastDownTimeR=state.time;
}
}
else if( lastMouse.buttons&mbRightButton )
ev->what ¦= MouseUpR;
if( state.buttons&mbMiddleButton )
{
if( lastMouse.buttons&mbMiddleButton )
{
if( state.time-G_MOUSE.lastDownTimeM>G_MOUSE.autoInterval )
ev->what ¦= MouseAutoM;
}
else
{
if( (state.time-G_MOUSE.lastDownTimeM)<G_MOUSE.doubleInterval &&state.time>G_MOUSE.lastDownTimeM )
ev->what ¦= MouseDoubleM;
else
ev->what ¦= MouseDownM;
G_MOUSE.lastDownTimeM=state.time;
}
}
else if( lastMouse.buttons&mbMiddleButton )
ev->what ¦= MouseUpM;
if( state.x!=lastMouse.x ¦¦ state.y!=lastMouse.y )
{
ev->what ¦= MouseMove;
}
ev->e.mouse.buttons=state.buttons;
ev->e.mouse.x=state.x+G_MOUSE.centre_X;
ev->e.mouse.y=state.y+G_MOUSE.centre_Y;
ev->e.mouse.keystate=bioskey(2);
lastMouse = state;
}
void Mouse_Set_DoubleTime(int n)
{
G_MOUSE.doubleInterval=n;
}
void Mouse_Set_AutoTime(int n)
{
G_MOUSE.autoInterval=n;
}
void Mouse_Hide(void)
{
union REGS ir,or;
ir.x.ax=2;
int86(0x33,&ir,&or);
}
void Mouse_Show(void)
{
union REGS ir,or;
ir.x.ax=1;
int86(0x33,&ir,&or);
}
void Mouse_Put_Pos(int x,int y)
{
Mouse_Hide();
mouse_intrx(4,0,x,y,0);
Mouse_Show();
}
void Mouse_Put_Centre(void)
{
Mouse_Put_Pos(G_MOUSE.max_X/2-G_MOUSE.centre_X,G_MOUSE.max_Y/2-G_MOUSE.centre_Y);
}
void Mouse_Get_Pos(int * x,int * y)
{
int m1=3,m2;
mouse_intr(&m1,&m2,x,y);
* x+=G_MOUSE.centre_X;
* y+=G_MOUSE.centre_Y;
}
int Mouse_In_Box(int left,int top,int right,int bottom)
{
int x,y;
Mouse_Get_Pos(&x,&y);
if(x<left¦¦x>right¦¦y<top¦¦y>bottom)
return(0);
else
return(1);
}
void Mouse_Set_Region(int left,int top,int right,int bottom)
{
mouse_intrx(7,0,left-G_MOUSE.centre_X,right-G_MOUSE.centre_X,0);
mouse_intrx(8,0,top-G_MOUSE.centre_Y,bottom-G_MOUSE.centre_Y,0);
}
void Mouse_Restore_Region(void)
{
mouse_intrx(7,0,0,G_MOUSE.max_X,0);
mouse_intrx(8,0,0,G_MOUSE.max_Y,0);
}
void Mouse_Set_Speed(int n)
{
mouse_intrx(0x0f,0,n,n<<1,0);
}
int Mouse_Init(void)
{
int ax=0,bx,cx,dx;
mouse_intr(&ax,&bx,&cx,&dx);
G_MOUSE.showState=1;
if(ax!=0)
G_MOUSE.OK=1;
else
G_MOUSE.OK=0;
G_MOUSE.showState=1;
G_MOUSE.lastDownTime=0L;
G_MOUSE.lastDownTimeR=0L;
G_MOUSE.lastDownTimeM=0L;
G_MOUSE.max_X=639;
G_MOUSE.max_Y=479;
G_MOUSE.centre_X=0;
G_MOUSE.centre_Y=0;
G_MOUSE.doubleInterval=7;
G_MOUSE.autoInterval=7;
return(G_MOUSE.OK);
}
回复人:rusteel(王锈才) (2001-4-6 15:20:00) 得0分
Windows中有一个PeekMessage函数可以同时检查鼠标和键盘的输入,具体可以查MSDN
回复人:coolfancy(心飞无际) (2001-4-6 19:30:00) 得0分
谢谢楼上两位兄弟的大力支持!!!
回复人:coolfancy(心飞无际) (2001-4-13 17:52:00) 得0分
还有吗?
回复人:yulong_ty(乐水) (2001-4-18 13:58:00) 得0分
去我的主页找找吧,看看Beauty开发库是否适合呢.
http://yourqxy.yeah.net