Link to home
Start Free TrialLog in
Avatar of Jimmyx1000
Jimmyx1000

asked on

Show form when Mouse moves to the top of the Desktop vb6

Id like to show a form when the mouse is moved to the top of the desktop

and then hide the form when the mouse moves  outside the form.


thanks experts


Avatar of Erick37
Erick37
Flag of United States of America image

8 open questions - some of which you have not even posted comments after receiving help.
Avatar of Jimmyx1000
Jimmyx1000

ASKER

ooopppps.

Sorted
And why you are asking same question twice?
ASKER CERTIFIED SOLUTION
Avatar of ajanthony
ajanthony

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I knew id make a mistake on my first ever post!  Sorry!

Paste this into the form instead...

------

Private Sub Timer1_Timer()
    Dim mouseposition As POINTAPI
   
    GetCursorPos mouseposition
       
       
    'if the window is invisible, check the mouse pointer location
    If Me.Visible = False Then
        'if the Y coord is 0 (ie top of screen), display the window
        If mouseposition.Y = 0 Then
            Me.Visible = True
            PutCursorInWindow Me.hWnd, 100, 100
            Exit Sub
        End If
   
    Else
        'if the mouse leaves the window, and hide the window.
        If IsCursorInWindow(Me.hWnd) = False Then
            Me.Visible = False
        End If
    End If

End Sub

Private Sub Form_Load()
    'setup the timer, hide the form
    Me.Visible = False
    Timer1.Interval = 10
    Timer1.Enabled = True
End Sub