FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Lock the mouse
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Lock the mouse
Posted: Sat Nov 13, 2021 06:40 PM

Hi,

How can I lock the mouse ?

Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: Lock the mouse
Posted: Sat Nov 13, 2021 06:56 PM
Hi, simples:

Code (fw): Select all Collapse
ShowCursor( 0 )

SysRefresh()


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Lock the mouse
Posted: Sat Nov 13, 2021 07: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

Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: Lock the mouse
Posted: Sat Nov 13, 2021 10:34 PM
Test, please.

Code (fw): Select all Collapse
// \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
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Lock the mouse
Posted: Sun Nov 14, 2021 06: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

Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: Lock the mouse
Posted: Sun Nov 14, 2021 01: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
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Lock the mouse
Posted: Tue Sep 10, 2024 11:22 AM
In the C language, they suggest disabling the mouse like this
Code (fw): Select all Collapse
system("xinput disable ID mouse")
Get the ID mouse from the xinput list
How can this be written in FW ?

Continue the discussion