CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 1999
    Location
    US, Florida
    Posts
    817

    If mouse moves off the form then form becomes invisible

    Thank you


  2. #2
    Join Date
    Sep 1999
    Location
    Red Wing, MN USA
    Posts
    312

    Re: If mouse moves off the form then form becomes invisible

    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
    [email protected]
    [email protected]
    Aaron Young
    Senior Programmer Analyst (Red Wing Software)
    Certified AllExperts Expert

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured