(35 pts) ActiveX - MouseOn / Off

I'm creating an ActiveX control that has the ability to be FLAT, but when you move your mouse over it, becomes 3D.

I can trap the MouseMove event to cause the button to become 3D, but how do you know when the mouse has moved off your ActiveX control to make it flat again?  Is there a way to trap the MouseMove event of the control's .Parent object to know that it no longer has the mouse over it?  Or is there an event of the UserControl that will tell me the mouse is exiting the control?

Thanks,

HATCHET
LVL 3
HATCHETAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

amit_panjwaniCommented:
u can use a picture control or a timer to get mouseovers

using timer
u will have to use getcursor api as well to get mouse co ordinates

the timer keeps on polling

secondly
u can use picture box

actually somebody had asked this question before as well
0
Erick37Commented:
The UserControl can capture the mouse when it detects mousemoves.  When the mouse moves outside the UserControl, the mouse is released.  Example:

Private Declare Function SetCapture Lib "user32" _
    (ByVal hwnd As Long) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long

Private bCaptured As Boolean

Private Sub UserControl_MouseMove(Button As Integer, _
        Shift As Integer, X As Single, Y As Single)
    If Not bCaptured Then
        SetCapture hwnd
        bCaptured = True
        Debug.Print "Mouse In"
    End If
    If (X < 0) Or (X > ScaleWidth) Or _
        (Y < 0) Or (Y > ScaleWidth) Then
        Debug.Print "Mouse Out"
        ReleaseCapture
        bCaptured = False
    End If
End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Erick37Commented:
P.S.
You also have to recapture the mouse in the click event:

Private Sub UserControl_Click()
    Debug.Print "Click"
    SetCapture hwnd
    bCaptured = True
End Sub
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Erick37Commented:
Correction in the code:

....
If (X < 0) Or (X > ScaleWidth) Or _
        (Y < 0) Or (Y > ScaleHeight) Then
....
0
HATCHETAuthor Commented:
Adjusted points to 35
0
HATCHETAuthor Commented:
Worked PERFECTLY !!!

Thanks a ton !      =D
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.