Thread View: comp.sys.ibm.pc.programmer
2 messages
2 total messages
Started by Douglas R. Nebeker - MIS_SAS
Thu, 08 Oct 1992 22:31
A Better Mousetrap
Author: Douglas R. Nebeker - MIS_SAS
Date: Thu, 08 Oct 1992 22:31
Date: Thu, 08 Oct 1992 22:31
52 lines
1811 bytes
1811 bytes
I'm building a mouse trap of sorts....
Actually, I just want to know if the mouse is being used (like the
_good_ screen saver TSRs out there--they don't blank your screen when no
keyboard input is coming in as long as the mouse is being moved).
I've successfully hooked the serial port interrupt (Int 14h?) and the mouse
interrupt (Int 33h). The mouse works like it always has, but my variable
'busy' never gets changed... (actually, that's a lie--when the mouse is
initialized, busy=M, but while the mouse is moving and buttons are being
pushed, busy doesn't get changed)
My question then is this: is there another way to access the mouse besides
through Int 33h? Does each mouse driver use a different Int for their
driver? Do I need to hook the DOS int 21h too?
Here is my example program:
#include <dos.h>
#ifdef __cplusplus
#define __CPPARGS ...
#else
#define __CPPARGS
#endif
unsigned char busy;
void interrupt ( *oldMOUSE)(__CPPARGS);
void interrupt newMOUSE(__CPPARGS)
{
busy='M';
oldMOUSE;
}
int main(void)
{
oldMOUSE = getvect(MOUSEINT);
setvect(MOUSEINT,newMOUSE);
keep(0, (_SS + (_SP+128/16) - _psp));
return 0;
}
THANKS A LOT
____
Douglas R. Nebeker Internet: $doug@sasb.byu.edu
Re: A Better Mousetrap
Author: Edward J Kalenda
Date: Sat, 10 Oct 1992 18:28
Date: Sat, 10 Oct 1992 18:28
31 lines
1899 bytes
1899 bytes
From article <$dougn.64.0@sasb.byu.edu>, by $dougn@sasb.byu.edu (Douglas R. Nebeker - MIS_SAS): > > I'm building a mouse trap of sorts.... > > Actually, I just want to know if the mouse is being used (like the > _good_ screen saver TSRs out there--they don't blank your screen when no > keyboard input is coming in as long as the mouse is being moved). > > I've successfully hooked the serial port interrupt (Int 14h?) and the mouse > interrupt (Int 33h). The mouse works like it always has, but my variable > 'busy' never gets changed... (actually, that's a lie--when the mouse is > initialized, busy=M, but while the mouse is moving and buttons are being > pushed, busy doesn't get changed) > > My question then is this: is there another way to access the mouse besides > through Int 33h? Does each mouse driver use a different Int for their > driver? Do I need to hook the DOS int 21h too? Many programs that use the mouse do not poll the driver for position and button state. They use the asynchronous notification functions of the mouse driver. With these, you set up a mask of events you want to be told about and the driver calls a routine in your program to tell you about the event. All kinds of restrictions on what the event handler routine can do, but better than polling in many cases. You will need to insert yourself between the driver and the program's event handler. -- Ed ekalenda@netcom.COM
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads