:?: 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

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

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 ?

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);
  }

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

apurv - will test restrictmouseptr(); thnx

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??

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. ;)

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.

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 ?

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

yea- i wud like the code apurv

yea- id like the code apurv

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

initmouse()
{
 inregs.x.ax=0;
 int86(0x33,&inregs,&opregs);
 return(opregs.x.ax);
}

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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.