Results 1 to 2 of 2

Thread: Disable and enable mouse

  1. #1
    Guest
    regarding to the subject, may i know how to use API to disable the mouse and enable it back.
    Thanks

  2. #2
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    India
    Posts
    298
    u can use the clipCursor and showCursor APIs.

    ShowCursor will show/hide the cursor depending on the parameter passed.

    using clipCursor u can restrict the area that the mouse can move in to 1 pixel, effectively preventing its movement.


    Declarations: (in the module)

    Public Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
    Public Declare Function ClipCursor Lib "user32" (lpRect As Any) As Long


    Code - In the form:

    'Declarations
    Private Type RECT
    Left As Long
    Right As Long
    Top As Long
    Bottom As Long
    End Type

    'To disable the mouse
    With TRect1
    .Left = 0
    .Top = 0
    .Right = 1
    .Bottom = 1
    End With
    ClipCursor TRect1
    ShowCursor False


    'To enable the mouse
    ClipCursor ByVal 0&
    ShowCursor True


    Let me know if this works. It should! )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width