荔园在线
荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀
[回到开始]
[上一篇][下一篇]
发信人: Peter (小飞侠), 信区: Program
标 题: DOS下的面向对象程序设计续5
发信站: BBS 荔园晨风站 (Thu Jan 21 21:02:40 1999), 转信
void interrupt MouseProcess()
{
//save ss and sp
asm MOV event,AX
asm MOV curstate,BX
asm MOV curx,CX
asm MOV cury,D
//main function
//GetMousePosition
disable();
if(event&2)
{
if((tail==head-1)||(tail==QueLength-1&&head==0))
goto end;
Message[tail].Event=LButtonDown;
Message[tail].Information1=curx; //curx,cury,prex,prey均为全局变量,前两
Message[tail].Information2=cury; //者为鼠标当前坐标,后两者为上次坐标
Message[tail].Information3=curstate;
tail++;
if(tail==QueLength)
tail=0;
RTime=7;
if((tail==head-1)||(tail==QueLength-1&&head==0))
{
LTime=0;
goto end;
}
if(LTime<=6&&curx==prex&&cury==prey)
{
Message[tail].Event=LButtonDBClick;
Message[tail].Information1=curx;
Message[tail].Information2=cury;
Message[tail].Information3=curstate;
tail++;
if(tail==QueLength)
tail=0;
}
LTime=0;
}
if(event&8)
{
if((tail==head-1)||(tail==QueLength-1&&head==0))
goto end;
Message[tail].Event=RButtonDown;
Message[tail].Information1=curx;
Message[tail].Information2=cury;
Message[tail].Information3=curstate;
tail++;
if(tail==QueLength)
tail=0;
LTime=7;
if((tail==head-1)||(tail==QueLength-1&&head==0))
{
RTime=0;
goto end;
}
if(RTime<=6&&cury==prey&&curx==prex)
{
Message[tail].Event=RButtonDBClick;
Message[tail].Information1=curx;
Message[tail].Information2=cury;
Message[tail].Information3=curstate;
tail++;
if(tail==QueLength)
tail=0;
}
RTime=0;
}
if(event&1)
{
if((tail==head-1)||(tail==QueLength-1&&head==0))
goto end;
tail--;
if(tail==-1)
tail=QueLength-1;
if(Message[tail].Event!=MouseMove||tail==head)
tail++;
if(tail==QueLength)
tail=0;
Message[tail].Event=MouseMove;
Message[tail].Information1=curx;
Message[tail].Information2=cury;
Message[tail].Information3=curstate;
tail++;
if(tail==QueLength)
tail=0;
}
if(event&4)
{
if((tail==head-1)||(tail==QueLength-1&&head==0))
goto end;
Message[tail].Event=LButtonUp;
Message[tail].Information1=curx;
Message[tail].Information2=cury;
Message[tail].Information3=curstate;
tail++;
if(tail==QueLength)
tail=0;
}
if(event&16)
{
if((tail==head-1)||(tail==QueLength-1&&head==0))
goto end;
Message[tail].Event=RButtonUp;
Message[tail].Information1=curx;
Message[tail].Information2=cury;
Message[tail].Information3=curstate;
tail++;
if(tail==QueLength)
tail=0;
}
end:
prex=curx;
prey=cury;
enable();
}
//待续
--
※ 来源:.BBS 荔园晨风站 bbs.szu.edu.cn.[FROM: 192.168.1.3]
[回到开始]
[上一篇][下一篇]
荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店