Results 1 to 4 of 4
  1. #1
    kdbailey is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2012
    Posts
    228

    Finding location of listbox on the SCREEN and not on the form


    I have code that finds the current position of the mouse on the screen in X,Y coordinates.

    I am curious if there is something similar that can let me know the X coordinate (basically the .left function but for the screen) of a listbox?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    The LEFT property of the list box. (plus FORM.LEFT)

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    AFAIK, the LEFT property is the amount of offset from the left edge of form or report, not a screen coordinate.

    I don't know anyway to do what you want.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    kdbailey is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2012
    Posts
    228
    Here is the code for finding the cursor position, not sure if anybody can do some sort of manipulation to find a stationary object.

    Code:
    Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long      ' Access the GetCursorPos function in user32.dll
        
    Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
    
    
          ' GetCursorPos requires a variable declared as a custom data type
          ' that will hold two integers, one for x value and one for y value
          
    Type POINTAPI
        xpos As Long
        ypose As Long
    End Type
    
    
    Public Function getmousepointx() As Integer
    
    
    Dim Hold As POINTAPI
    
    
    GetCursorPos Hold
    
    
    getmousepointx = Hold.xpos
    
    
    End Function
    
    
    Public Function getmousepointy() As Integer
    
    
    Dim Hold As POINTAPI
    
    
    GetCursorPos Hold
    
    
    getmousepoint = Hold.ypos
    
    
    End Function

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 07-10-2013, 08:57 AM
  2. Replies: 7
    Last Post: 02-01-2013, 02:58 PM
  3. finding a record in a listbox part 2
    By mgwat69 in forum Programming
    Replies: 19
    Last Post: 11-14-2011, 01:31 PM
  4. finding a record in a listbox
    By mgwat69 in forum Programming
    Replies: 2
    Last Post: 10-03-2011, 11:38 AM
  5. Replies: 11
    Last Post: 06-05-2011, 09:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums