Results 1 to 3 of 3

Thread: A bit code to test if mouse out of listview control

  1. #1
    mega's Avatar
    mega is offline Newbie Net Builder
    Join Date
    May 2009
    Location
    Hell , Wanna Come ??
    Posts
    62
    Thanks
    0
    Thanked 10 Times in 4 Posts

    Red face

    Check to see if cursor was outside client area of a listview controlAdd a form to a new project.Add a listview control to the form created aboveAdd a module to the projectDouble-click the module and type in the following code segment
    <a href="http://ipost2host.com/viewtopic.php?f=13&t=2362#" target="_blank">
    </a>
    Code:
    Public Type POINTAPI
       x as Long
       y as Long
    End Type
    
    Public Declare Function GetCursorPos lib "user32" Alias "GetCursorPos" (ByRef lpPoint as POINTAPI) As Long
    Public Declare Function ScreenToClient lib "user32" Alias "ScreenToClient" (ByVal hwnd as Long, ByRef lpPoint as POINTAPI) As Long
    Public Declare Function SetCapture(ByVal hwnd as Long) as Long
    Public Declare Function ReleaseCapture() As Long

    Double-click the listview control and select the mousemove event from the dropdown box at top of editor window.
    Copy and paste the code below in the event handler

    <a href="http://ipost2host.com/viewtopic.php?f=13&t=2362#" target="_blank">
    </a>
    Code:
    Static captured As Boolean
    
    Dim currentPoint AS POINTAPI
    
         currentPoint.x = x
         currentPoint.y = y
    
         GetCursorPos currentPoint
         ScreenToClient Me.Hwnd, currentPoint
    
        If Not (captured) Then
             SetCapture Me.Hwnd
             captured = True
        End If
    
        If (CurrentPoint.X < ListView2.left Or CurrentPoint.X > ListView2.left + ListView2.Width) Or _
            (CurrentPoint.Y < ListView2.top Or CurrentPoint.Y > ListView2.top + ListView2.Height) Then
            ReleaseCapture
            captured = False
        End If
    Never argue with an idiot; First he takes you down to his level and then he beats you with experience.

  2. #2
    ghadeer is offline Net Builder
    Join Date
    Oct 2009
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts
    its nice (vb6)
    thanks for sharing

  3. #3
    Aytac01's Avatar
    Aytac01 is offline Newbie Net Builder
    Join Date
    Feb 2009
    Location
    Webhost Hell!
    Posts
    83
    Thanks
    0
    Thanked 3 Times in 3 Posts
    VB6 is old... but...
    Nice for Sharing

    It&#39;s soo easy to master VB6 :P

Similar Threads

  1. Replies: 0
    Last Post: 29 March, 2011, 12:21 PM
  2. Mouse, Mouse :)
    By Hellas in forum Entertainment
    Replies: 3
    Last Post: 9 May, 2010, 13:35 PM
  3. Need someone to test a page
    By Mr.Bill in forum Programming
    Replies: 6
    Last Post: 13 June, 2009, 12:41 PM
  4. The Mouse Game
    By Aquarezz in forum General Chat
    Replies: 18
    Last Post: 2 June, 2009, 01:25 AM

Tags for this Thread

Bookmarks

Posting Permissions

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