home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.msdos.programmer
- Path: sparky!uunet!gumby!wupost!cs.utexas.edu!tamsun.tamu.edu!ski8032
- From: ski8032@tamsun.tamu.edu (The Man Behind The Curtain)
- Subject: Re: Capturing Mouse Interrupts
- Message-ID: <1992Nov16.185802.8557@tamsun.tamu.edu>
- Keywords: mouse capture interrupt IRQ
- Organization: Texas A&M University, College Station
- References: <ua#@byu.edu>
- Date: Mon, 16 Nov 1992 18:58:02 GMT
- Lines: 62
-
- Thus spake $dougn@sasb.byu.edu (Douglas R. Nebeker - MIS_SAS):
- >I am trying to hook the mouse interrupts so that each time the mouse is
- >moved, my routine can be notified. I've tried hooking Int 33h, [...]
- Instead of doing that, try this:
-
- [..other mouse code removed..]
-
- /* Define interrupt subroutine parameters - This function allows you to
- specify your own interrupt routine to take over the handling of mouse
- activities when any given event specified by the bit mask in event
- occurs.
- Call mask : Word whose first five bits indicate on which events
- the interrupt should be invoked.
- 0 Mouse moves
- 1 Left mouse button pressed
- 2 Left mouse button released
- 3 Right mouse button pressed
- 4 Right mouse button released
- */
-
- void install_mouse_interrupt(void far *mouse_handler, int callmask) {
-
- asm mov ax,12; /* Install user-interrupt service */
- asm mov cx,callmask
- asm mov dx, mouse_handler
- asm mov es, dx
- asm mov dx, mouse_handler+2
- asm int 0x33
- }
-
- This should work just fine. You can use it like this:
-
-
- #include <conio.h>
- #include "mouse.h"
-
- void far mouse_handler(void) {
- /* Your code here */
- /* Note that this is not an ISR; it is a simple function */
- return;
- }
-
- int main(void) {
- install_mouse_interrupt(mouse_handler, 31); /* all events trapped */
- getch();
- putch(7);
- install_mouse_interrupt(mouse_handler, 0); /* disable trapping */
- return 0;
- }
-
- >Thanks in advance for ANY help!
-
- If you would like the rest of the mouse routines (though they are
- fairly simple) send me email.
-
- >Douglas R. Nebeker Internet: $dougn@sasb.byu.edu
-
- --
- Till next time, \o/ \o/
- V \o/ V email:pinky@tamu.edu
- <> Sam Inala <> V
-
-