Not a Member Yet,
Click here to Register

ID: 409
Viewed: 3337
Added: Aug 19, 2002
Snippet uploaded by: snippet
Written By: Unknown
Demo: Sorry, no demo

User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

Restrict Mouse / Hide Cursor

Highlight all by clicking in box
'You can use the ClipCursor And ShowCursor APIs, ie.

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

Private Declare Function ClipCursor Lib "user32" (lpRect As Any) As Long
Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long

Highlight All
Private Sub Command1_Click()
Static bRestricted As Boolean

bRestricted = Not bRestricted
If bRestricted Then
'Restrict the Cursor to Inside the Form Area
Call GetWindowRect(hwnd, tRECT)
Call ClipCursor(tRECT)
'Release the Cursor
Call ClipCursor(ByVal 0&)
End If
End Sub

Private Sub Command2_Click()
Static bHide As Boolean
bHide = Not bHide
Call ShowCursor(Abs(Not bHide))
End Sub

No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.

Replying to a Comment...

Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2021 All Rights Reserved. Conditions
Do NOT follow this link or you will be banned from the site!