|
-
Aug 9th, 2000, 07:11 AM
#1
Thread Starter
Lively Member
Hi! How can a control knows that the Mouse Pointer has just
pass, sort of a LostFocus.
I know that a MouseMove event will trigger everytime the
mouse pointer passes through a control
(PictureBox, Image..., Button etc...). I'd like to know
what event will trigger if the control just lost the
mouse pointer. Is there any... or any work around?
Thanks for any help
- I'm using VB 6.0 Enterprise Edition
-
Aug 9th, 2000, 07:20 AM
#2
transcendental analytic
You would have to use a timer, check for the mouseposition using Getcursorpos api and check if it's in the rect of your control, using Getwindowrect for controls with hwnd or just using the left, top, width and height properties for a image
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Aug 9th, 2000, 07:23 AM
#3
Member
No, but you could use the API calls getmousepos and getwindowrect.
If you use getwindowrect to get the rectangle of the window( that is its perimeter) you can work out if the mouse it over it or not, for this you will need a timer to monitor the cursor position and the control position, i have had to do this for one of my projects before and it did work, if you want me to mail you a demo just say.
Hope this helps,
Grant French
-----------------------------------------------
E-Mail: [email protected]
ICQ: 33122184
-
Aug 9th, 2000, 07:27 AM
#4
Member
Hi Again
Sorry, slight alteration to the previous messagem what i meant to say is if you get the cursor position you can then use get windowfrompoint to find the handle of the window under the mouse cursor, then compare this with the handle of your control.
Sorry about that, once again if you want a demo just say
Grant French
-----------------------------------------------
E-Mail: [email protected]
ICQ: 33122184
-
Aug 9th, 2000, 08:20 AM
#5
Try this:
Code:
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Dim lpoint As POINTAPI
Private Sub Timer1_Timer()
GetCursorPos lpoint
Retval = WindowFromPoint(lpoint.x, lpoint.y)
'If the hWnd is the same as Command1 then...
If Retval = Command1.hwnd Then
Text1 = "It's on Command1"
Else
Text1 = "It's not on command1"
End If
End Sub
-
Aug 10th, 2000, 12:15 AM
#6
Thread Starter
Lively Member
Thanks guys for your help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|