Results 1 to 4 of 4

Thread: Get X-Y position of a control????

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2000
    Posts
    1,463

    Question Get X-Y position of a control????

    I bet this is a tough question!

    How can I get the X / Y coordinates of a control in a program so I can capture only that part? I have the class name and the handle and I need to capture only that part of the screen. The control can be in a different position of the program depending how the user has it setup because it is in Outlook Express.

    Is there an API call I can do to get this?

    Anyone have any suggestions?

    Thanks!

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    You can use this API:
    Declare Function GetWindowRect Lib "user32" Alias "GetWindowRect" (ByVal hwnd As Long, lpRect As RECT) As Long

    · hWnd
    Identifies the window.

    · lpRect
    Points to a RECT structure that receives the screen coordinates of the upper-left and lower-right corners of the window.
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2000
    Posts
    1,463
    Thanks, works great!!!

  4. #4
    Megatron
    Guest
    If you want to capture the points of a child window, you would either need to use GetClientRect, or if the control actually has a separate client section, then you need to convert the coordinates (from GetWindowRect) to the client coordinates by using the ScreenToClient function.

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