Lock the mouse

Lock the mouse

Postby Natter » Sat Nov 13, 2021 6:40 pm

Hi,

How can I lock the mouse ?
Natter
 
Posts: 1221
Joined: Mon May 14, 2007 9:49 am

Re: Lock the mouse

Postby karinha » Sat Nov 13, 2021 6:56 pm

Hi, simples:

Code: Select all  Expand view

ShowCursor( 0 )

SysRefresh()
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Lock the mouse

Postby Natter » Sat Nov 13, 2021 7:06 pm

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
Natter
 
Posts: 1221
Joined: Mon May 14, 2007 9:49 am


Re: Lock the mouse

Postby karinha » Sat Nov 13, 2021 10:34 pm

Test, please.

Code: Select all  Expand view

// \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
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Lock the mouse

Postby Natter » Sun Nov 14, 2021 6:42 am

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
Natter
 
Posts: 1221
Joined: Mon May 14, 2007 9:49 am

Re: Lock the mouse

Postby karinha » Sun Nov 14, 2021 1:48 pm

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
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Lock the mouse

Postby Natter » Tue Sep 10, 2024 11:22 am

In the C language, they suggest disabling the mouse like this
Code: Select all  Expand view
system("xinput disable ID mouse")

Get the ID mouse from the xinput list
How can this be written in FW ?
Natter
 
Posts: 1221
Joined: Mon May 14, 2007 9:49 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 44 guests