Results 1 to 3 of 3

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

Hybrid View

  1. #1
    Join Date
    May 2009
    Hell , Wanna Come ??

    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="" target="_blank">
    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="" target="_blank">
    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 < Or CurrentPoint.Y > + ListView2.Height) Then
            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
    its nice (vb6)
    thanks for sharing

  3. #3
    Join Date
    Feb 2009
    Webhost Hell!
    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


Posting Permissions

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