delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/30/18:29:51

Date: Tue, 30 Dec 1997 15:29:02 -0800 (PST)
Message-Id: <199712302329.PAA23727@adit.ap.net>
Mime-Version: 1.0
To: ludvig AT club-internet DOT fr, djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Hook up mouse int to function again

At 07:25  12/30/1997 +0100, Ludvig Larsson wrote:
>Hi!
>
>I have hooked up a function that should be called
>when the mouse moves or I push a mousebutton(int10,ax=0x0009), and that
>works, but when the function is called the program exits
>and I get a window(win95) that says that a 'problem'(operation non
>conformé in french) occured at 0002:FFFF.
>I have actually only ripped the example out of the FAQ 18.8:
>
>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;
>}
It is necessary to tell the INT 33h call the address of your callback. Add
these lines before __dpmi_int:
r.x.es = callback_info.rm_segment;
r.x.dx = callback_info.rm_offset;

>void mouse_handle(__dpmi_regs *preg)
>

This argument, and `callback_regs', should be of type
`_go32_dpmi_registers', not `__dpmi_regs'. I think they might be the same
right now, but just to be pedantic...

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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