
mouse move event detected with no mouse movement?!?
hi,
Quote:
> I was writing a 'screen-saver' type program where I want the
> demo to be interrupted by the user through any kind of input
> (eg. keypress, mousemove etc.).
> In the (only) form in the program I made a Sub Form_MouseMove
> subroutine that basically stopped the demo. However, when I run
> the code the demo starts, but stops immediately (trace tells me
> that it is percievig a MouseMove event).
Yep, i had the same problem. The MouseMove event is triggered when loading
the form. It sometimes even get's triggered when Timer controls are
enabled. Very weird.
This is my sollution :
Sub Form_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As
Single)
Static iCount As Integer
Static iX As Integer, iY As Integer
'
' Count MouseMove events
'
iCount = iCount + 1
'
' If this is the second MouseMove event
'
If iCount = 2 Then
'
' If the mouse pointer actually moved,
' End the screen saver
'
If iX <> X Or iY <> Y Then
Unload Me
End If
iCount = 0
End If
'
' Save the current mouse pointer coordinated
'
iX = X
iY = Y
End Sub
Bye Jan...