From: Leif Newsgroups: comp.os.msdos.djgpp Subject: Re: (new guy) mouse woes Date: Sat, 24 Oct 1998 22:43:35 -0700 Organization: NorthWest Nexus Inc. Lines: 34 Message-ID: <3632BA87.655D@hotmail.com> References: <70ivmg$fak$1 AT nnrp1 DOT dejanews DOT com> NNTP-Posting-Host: blv-pm103-ip27.halcyon.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.04 (Win95; I) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com jsc AT lds DOT co DOT uk wrote: > > Hello all, > I'm new here (mainly because my news program recently committed suicide). > I'm having a few probs with using a mouse in djgpp. I have a function > > void mouse_abs_pos(int *x, int *y) > { > union REGS regs; > regs.x.ax = 0x03; > int86(0x33, ®s, ®s); > *x = regs.x.cx; > *y = regs.x.dx; > return 0; > } > Like someone else posted... call yer function like this... mouse_abs_pos(&MouseX, &MouseY); BUT!!! Inside of that function you should use the .w members instead of the .x ones. EXAMPLE: *x = regs.w.cx; instead of *x = regs.x.cx; Using the .w members makes SURE the cx is treated as 16bit. The .x can be either 16 or 32bit which will give you screwy x and y values if it happens to be 32 bit. I ran into that problem when I was trying to get my mouse stuff working. Hope it helps...