Click to See Complete Forum and Search --> : If mouse moves off the form then form becomes invisible


AndyK
November 11th, 1999, 09:55 PM
Thank you

Aaron Young
November 11th, 1999, 10:20 PM
Try this:

Add a Timer Control to a Form..

private Type POINTAPI
x as Long
y as Long
End Type
private Declare Function GetCursorPos Lib "user32" (lpPoint as POINTAPI) as Long

private Sub Form_Activate()
Timer1.Enabled = true
End Sub

private Sub Form_Load()
Timer1.Interval = 100
End Sub

private Sub Timer1_Timer()
Dim tPA as POINTAPI
Call GetCursorPos(tPA)
If tPA.x < ScaleX(Left, vbTwips, vbPixels) Or tPA.x > ScaleX(Left + Width, vbTwips, vbPixels) Or tPA.y < ScaleY(Top, vbTwips, vbPixels) Or tPA.y > ScaleY(Top + Height, vbTwips, vbPixels) then
Timer1.Enabled = false
Hide
End If
End Sub





Aaron Young
Analyst Programmer
adyoung@win.bright.net
aarony@redwingsoftware.com