delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/21/19:31:38

From: eggbrains AT aol DOT com (Egg brains)
Newsgroups: comp.os.msdos.djgpp
Subject: computer freezes when i try to get a mouse event using 0x33 ax=0c
Date: 22 Nov 1997 00:05:52 GMT
Lines: 61
Message-ID: <19971122000501.TAA27488@ladder01.news.aol.com>
NNTP-Posting-Host: ladder01.news.aol.com
Organization: AOL http://www.aol.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

okay, a few days ago i posted a message here.  i got all the answers i needed
(thanks) and no errors were genertated while it was compiling (so far so good)
then when i ran it and clicked my left mouse button (the event I am trying to
trap)... it generated and annoying win95 error and quit.  i tried running it in
dos and it froze all thogether. 

i think this is because i am setting a bad vector so that the mouse calls a bad
reference on the event.... am i right? and does anyone know why this is
occuring?


---- CODE SNIPPET ----

#include <iostream.h>
#include <dpmi.h>
#include <go32.h>
static __dpmi_regs callback_regs;
static _go32_dpmi_seginfo callback_info;

void happySub(__dpmi_regs *)
{
 cout << "abc!!!";
 return;
}

long initMouse(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;
}

void main()
{
  char *dummy;
  cout << "mouse demo";
  initMouse(0x01, happySub);
  
  for(long i; i>0; i++){
    cout << i << endl;
  }

  cin >> dummy;
}
----END CODE SNIPPET----

Thanks in advance,
  Paul
"DJGGP is cool, but it is _only_ a tool.
Nothing more, Nothing less.  It's strength 
comes from _how_ you use it." 
--Paul Stickney (Me)

- Raw text -


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