
10-13-2000, 06:32 PM
|
 |
Code Meister
Retired Moderator * Guru *
|
|
Join Date: Aug 2000
Location: Vancouver, BC, Canada
Posts: 10,441
|
|
Re: trapping mouse in picture box
|
You can use the clipcursor API call. Here is a quick example:
<PRE><CODE>
'declared in a module
Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Public Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Public Declare Sub ClipCursor Lib "user32" (lpRect As Any)
Public Declare Sub ClipCursorAll Lib "user32" Alias "ClipCursor" (ByVal n As Long)
Public Sub RestrictCursor(p as picturebox)
dim r as RECT
GetWindowRect p.hwnd, r
ClipCursor r
end sub
public sub ReleaseCursor()
ClipCursorAll 0
end sub
</PRE></CODE>
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
|
__________________
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
|