From: "J. L." Newsgroups: comp.os.msdos.djgpp Subject: Re: problem with mouse Date: Wed, 2 Jul 2003 16:23:52 -0500 Lines: 126 Message-ID: References: <001201c340bc$f8096360$0105a8c0 AT luiz> NNTP-Posting-Host: 200.34.143.28 X-Trace: fu-berlin.de 1057181039 34818765 200.34.143.28 (16 [143309]) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Once upon a while, Luiz Rafael Culik Guimaraes wrote in 001201c340bc$f8096360$0105a8c0 AT luiz: > Dear Friends > > I has an problem with mouse > using the follow function > > int getpos(void) > { > union REGS r; > r.x.ax=3; > int86(0x33&r,&r); > return r.x.cx/8; > } > > this return weird numbers like 132514, 125465 I hope not sound stupid, but... did you initialize the mouse? > I´m using an Amd Duron Processor and an Geoforce 2 mx 400. > > is this related > I don't believe it. > Regards > Luiz The follow snipet is based on the code in thread suggested before: ----begin C code ---- #include #include #include int mouse_installed=0; void mouse_show(void) { union REGS r; r.x.ax = 0x01; int86(0x33, &r, &r); } void mouse_hide(void) { union REGS r; r.x.ax = 0x02; int86(0x33, &r, &r); } void position_mouse(int x, int y) { union REGS r; r.x.ax = 4; r.x.cx = x; r.x.dx = y; int86(0x33, &r, &r); } void mouse_init(void){ int res; union REGS r; r.x.ax=0; res=int86(0x33, &r,&r); if(res==0xFFFF) mouse_installed = 1; else mouse_installed = 0; } void getpos(int *col, int *row){ union REGS r; r.x.ax=3; int86(0x33, &r,&r); *col=r.x.cx/8; *row=r.x.dx/8; } int mouse_buttons(void){ union REGS r; r.x.ax=5; int86(0x33, &r,&r); return r.x.bx; } int main(void){ int test, pos, x=0, y=0; clrscr(); gotoxy(1,1); mouse_init(); if(mouse_installed){ mouse_show(); while (!kbhit()){ printf("posici˘n del raton: columna %2d; rengl˘n %2d\r", x, y); getpos(&x, &y); } } return 0; } ----end C code -------------- Not so clean, but works. Hope this helps. Regards -- José L. Sánchez Garrido