Hi,
I'm trying to change a parent image control when a button is hovered over in the sub form.
I can achieve this but the screen flickers like mad.
So to try to stop the mouse_even API firing continuously, I'm trying to trap the X/Y co-ordinates so I can see if the mouse has moved to a different control.
However, debuging the Y co-ordinate shows that the number is bizarre and doesn't accurately represent the same location each time.
I'm hovering over the same control, move the mouse a fraction and the Y co-ordinate can vary by over 200 -> that's impossible!
So what gives with the Y co-ordinate passed to the mousemove event handler?
"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music
I'm trying to change a parent image control when a button is hovered over in the sub form.
I can achieve this but the screen flickers like mad.
So to try to stop the mouse_even API firing continuously, I'm trying to trap the X/Y co-ordinates so I can see if the mouse has moved to a different control.
However, debuging the Y co-ordinate shows that the number is bizarre and doesn't accurately represent the same location each time.
I'm hovering over the same control, move the mouse a fraction and the Y co-ordinate can vary by over 200 -> that's impossible!
So what gives with the Y co-ordinate passed to the mousemove event handler?
Code:
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Const MOUSEEVENTF_LEFTDOWN = &H2
Const MOUSEEVENTF_LEFTUP = &H4
Private sY As Single
Private Sub LogoHover_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Y < (sY - 50) Or Y > (sY + 50) Then
MsgBox ("y = " & Y & ", sY = " & sY)
sY = Y
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0&, 0&, 0, 0
End If
If Nz(Me.LogoExt, "") <> "" Then
Parent.Logo.Picture = cDrive & "\Logos\" & Me.ProviderID & "." & Me.LogoExt
Else
Call MouseMove
End If
End Sub
Private Sub MouseMove()
Parent.Logo.Picture = cDrive & "\Logos\click_logo.bmp"
End Sub
"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music