:?: Is there any way, in Turbo C++, by which we can make the mouse disappear when it enters a certain area of the screen ?

I have tried this but it doesnt seem to work completely....
------------------------------------------------------------------------------------

void initmouse()
{
union REGS in,out;
in.x.ax=0;
int86(0x33,&in,&out);
}
void showmouse()
{
union REGS in,out;
in.x.ax=1;
int86(0x33,&in,&out);
}
void hidemouse()
{
union REGS in,out;
in.x.ax=2;
int86(0x33,&in,&out);
}
int getcord(int &x,int &y)
{
union REGS in,out;
in.x.ax=3;
int86(0x33,&in,&out);
x=out.x.cx;
y=out.x.dx;
return out.x.bx;
}
void main()
{
int mousex,mousey;
initmouse();
showmouse();
if(getcord(mousex,mousey)==1)
{
if(mousex>=430&&mousex<=630&&mousey>=22&&mousey<=436)
showmouse();
else
hidemouse();
}
}

-----------------------------------------------------------------------------------
I can get the mouse to appear on the screen but it doesnt disappear on entering certain coordinates.

Please Help

Re: Usimg the mouse in Turbo C++ 80 80

Don't know. Have you tested the hidemouse() function outside of this program?

Re: Usimg the mouse in Turbo C++ 80 80

Don't know. Have you tested the hidemouse() function outside of this program?

I can help u out.
I have a simple function restrictmouseptr()
wanna it ?

Re: Usimg the mouse in Turbo C++ 80 80

try this...

void restrictmouseptr(int x1, int y1, int x2, int y2)
  {
   i.x.ax=7;
   i.x.cx=x1;
   i.x.dx=x2;
   int86(0x33,&i,&o);
   i.x.ax=8;
   i.x.cx=y1;
   i.x.dx=y2;
   int86(0x33,&i,&o);
  }
Re: Usimg the mouse in Turbo C++ 80 80

WaltP-yeah....i tested hidemouse(); ...works fine outside the program.....

apurv - will test restrictmouseptr(); thnx

Re: Usimg the mouse in Turbo C++ 80 80

Apurv- thanx for the code......only problem is that now even when i close the output screen, the mouse remains to be restricted to a certain area(even in turbo cpp program screen)....any ideas??

Re: Usimg the mouse in Turbo C++ 80 80

Try outputting a character when you are in hidemouse() to be sure you are in fact executing it.

apurv, when you post something you should at least explain what it does... For all we know, that code could erase your disk. ;)

Re: Usimg the mouse in Turbo C++ 80 80

Apurv- thanx for the code......only problem is that now even when i close the output screen, the mouse remains to be restricted to a certain area(even in turbo cpp program screen)....any ideas??

reset the mouse pointer before exiting from ur program.

Re: Usimg the mouse in Turbo C++ 80 80

Apurv- thanx for the code......only problem is that now even when i close the output screen, the mouse remains to be restricted to a certain area(even in turbo cpp program screen)....any ideas??

want the code to reset mouse pointer ?

Re: Usimg the mouse in Turbo C++ 80 80

want the code to reset mouse pointer ?

I would assume you need code like this to reset the mouse pointer:

union REGS in,out;
int callmouse()
{
         in.x.ax=1;
         int86(51,&in,&out);
         return 1;
}

In this example, 51 is the interrupt, in.x.ax is set to 1 for the service, (because service 1 resets the mouse), and int86() is the actual call. out returns the actual position of the mouse.

Hope this helps

Re: Usimg the mouse in Turbo C++ 80 80

yea- i wud like the code apurv

Re: Usimg the mouse in Turbo C++ 80 80

yea- id like the code apurv

Re: Usimg the mouse in Turbo C++ 80 80

joeprogrammer- the code isnt working...im not sure why but the mouse is still restricted to that area

Re: Usimg the mouse in Turbo C++ 80 80
initmouse()
{
 inregs.x.ax=0;
 int86(0x33,&inregs,&opregs);
 return(opregs.x.ax);
}
Re: Usimg the mouse in Turbo C++ 80 80

Check out this link - Mouse Programming with C

Re: Usimg the mouse in Turbo C++ 80 80

i want execution to wait until mouse button is pressed......
please help........

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.