Announcement

Collapse
No announcement yet.

Hide the cursor using User32.dll

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hide the cursor using User32.dll

    Hi there,
    I am trying to hide/show the cursor using User32.dll.
    My OS is Windows 10 Pro x64.

    I use this script to hide the cursor:
    DLL.CallFunction(_SystemFolder.."\\User32.dll", "ShowCursor", "0", DLL_RETURN_TYPE_INTEGER, DLL_CALL_CDECL);

    And this one to show it:
    DLL.CallFunction(_SystemFolder.."\\User32.dll", "ShowCursor", "1", DLL_RETURN_TYPE_INTEGER, DLL_CALL_CDECL);

    But my app crashes executing these scripts.
    What could be the reason?

  • #2
    Use this instead:

    Code:
    -- hide cursor
    DLL.CallFunction(_SystemFolder.."\\User32.dll", "ShowCursor", "0", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
    
    -- show cursor
    DLL.CallFunction(_SystemFolder.."\\User32.dll", "ShowCursor", "1", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
    Ulrich

    Comment


    • #3
      Unfortunately, it doesn't work... ((

      Comment


      • #4
        Build and run the attached sample project, and check the result. Note that the cursor remains hidden only while inside the application window, if you move it away from the application window, it will reappear.

        Ulrich
        Attached Files

        Comment


        • #5
          Thanks, I will check this sample project ))

          Comment

          Working...
          X
          😀
          🥰
          🤢
          😎
          😡
          👍
          👎