Lock the mouse

Post Reply
Natter
Posts: 1241
Joined: Mon May 14, 2007 9:49 am

Lock the mouse

Post by Natter »

Hi,

How can I lock the mouse ?
User avatar
karinha
Posts: 7932
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Been thanked: 3 times
Contact:

Re: Lock the mouse

Post by karinha »

Hi, simples:

Code: Select all | Expand


ShowCursor( 0 )

SysRefresh()
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Natter
Posts: 1241
Joined: Mon May 14, 2007 9:49 am

Re: Lock the mouse

Post by Natter »

Thank you, Karinha! But that's not what I need. I don't need to hide the cursor, but to prevent it from moving around the screen
User avatar
karinha
Posts: 7932
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Been thanked: 3 times
Contact:

Re: Lock the mouse

Post by karinha »

Test, please.

Code: Select all | Expand


// \samples\TRAVMOUS.PRG

#Include "FiveWin.ch"

STATIC oWnd, oTimer

FUNCTION Main()

   LOCAL oBar, oExit

   PUBLIC oTimer

   DEFINE WINDOW oWnd TITLE "Lock Mouse - Look This."

   DEFINE BUTTONBAR oBar BUTTONSIZE 64, 50 _3DLOOK TOP OF oWnd 2007

   DEFINE BUTTON oExit OF oBar NOBORDER GROUP PROMPT "&Exit"                ;
      FILENAME "..\bitmaps\16x16\Exit.bmp"                                  ;
      ACTION( oWnd:End() ) TOOLTIP "Exit this app" TOP

   SET MESSAGE OF oWnd TO "Lock Mouse" NOINSET CLOCK DATE KEYBOARD

   oTimer := TTimer():New( 5, {|| RRLOCK_MOUSE() }, oWnd )

   oTimer:Activate()

   SysRefresh()

   // Right click
   oWnd:bRClicked := {|| RCloseProg() }

   ACTIVATE WINDOW oWnd MAXIMIZED

   oTimer:End()

RETURN NIL

FUNCTION RCloseProg()

   oWnd:End()

RETURN NIL

STATIC FUNCTION RRLOCK_MOUSE()

   SetCursorPos( 500,  500 )  // 1000, 1000

RETURN( .T. )

// FIN / END
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Natter
Posts: 1241
Joined: Mon May 14, 2007 9:49 am

Re: Lock the mouse

Post by Natter »

Thanks, I'm actually processing :MMove() on the window. Each time the cursor coordinates change, some processing takes time (and the user, at this time, moves the mouse). Thus, synchronization is disrupted. I was hoping to solve this by RUNSLL32.exe mouse, disable But under 10 it doesn't work
User avatar
karinha
Posts: 7932
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Been thanked: 3 times
Contact:

Re: Lock the mouse

Post by karinha »

Example?

It's always easier to get support when you have a simple example of what you want to do and you're not getting it.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Natter
Posts: 1241
Joined: Mon May 14, 2007 9:49 am

Re: Lock the mouse

Post by Natter »

In the C language, they suggest disabling the mouse like this

Code: Select all | Expand

system("xinput disable ID mouse")
Get the ID mouse from the xinput list
How can this be written in FW ?
Post Reply