www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/19/16:15:42

From: Ian <dr838303 AT cs DOT nthu DOT edu DOT tw>
Newsgroups: comp.os.msdos.djgpp
Subject: mouse problem
Date: 19 Sep 1998 20:05:30 GMT
Organization: Dept. of Computer Science, Nat'l Tsing Hua Univ., Taiwan, R.O.C.
Lines: 48
Message-ID: <6u12qa$t08$1@news.cs.nthu.edu.tw>
NNTP-Posting-Host: cs20.cs.nthu.edu.tw
NNTP-Posting-Date: 19 Sep 1998 20:05:30 GMT
User-Agent: tin/pre-1.4 (C)-980730 (UNIX) (SunOS/4.1.4 (sun4m))
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hello everybody,

Would anyone help answering the following question? Thanks in advance.

Recently I need to use mouse in my program. I copy the following mouse
installing subroutine from djgpp (ver 1.xx) FAQ without any change:

int install_mouse_handler (unsigned mask,
               void (*func)(__dpmi_regs *))
 {
     __dpmi_regs r;

     callback_info.pm_offset = (long)func;
     if (_go32_dpmi_allocate_real_mode_callback_retf(&callback_info,
                             &callback_regs))
       return -1;  /* failure */

     r.x.ax = 0xc;
     r.x.cx = mask;
     __dpmi_int (0x33, &r);
     return (r.x.flags & 1) ? -1 : 0;
  }

then I wrote a small testing callback as follows

   void func( __dpmi_regs *callback_regs )
   {
    if((callback_regs->x).bx!=0) printf("mouse button %d\n", (callback_regs->x).
bx);
   }

main program is the following

void main (void)
  {
    if (install_mouse_handler(31, func)) goto Error;
    getch();
    return;
Error:
    printf("error\n");
    return;
  }

Compiling is OK. But error occurs and forces to close dos box (win 95) at
runtime immediately when I move the mouse or push the button.

Thank you for reading this.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019