Thread: Getting window coordinates in large windows.

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    1

    Getting window coordinates in large windows.

    Hi,

    I need to acquire the client-area mouse coordinates in a window of a third party application. I have used GetCursorPos and ScreenToClient to get the mouse coordinates when the scrollbars are positioned at the top-left position. The client area of the window who’s coordinates I need are usually much larger then the window itself. If you use ScreenToClient in the window when the scrollbars are positioned a few 1000 pixels to the right and down from the upper left corner you will get the position of the mouse pointer relative to the upper left corner of the visible rectangle. Is there a way to get the difference between the upper left corner of the other apps window and the upper left corner of the visible area of the same window?

    Thanks

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Hi, welcome to the forums.

    I think you will have to calculate the offset yourself. You can get the position of a scroll bar with the GetScrollPos or GetScrollInfo functions. This assumes the other application is using standard scroll bars. If not, the information may not be easily available.

  3. #3
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    In Win32 terminology, the client area of a window is the part of the window that is not taken up by the frame, title bar, menu bar, and possibly (depending on who you ask) toolbars and status bar and similar stuff.

    What you're looking for is the position of the mouse within the document view. Because views are application specific, so must be the code that calculates this position.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. creating a child window
    By rakan in forum Windows Programming
    Replies: 2
    Last Post: 01-23-2007, 03:22 PM
  2. Why only 32x32? (OpenGL) [Please help]
    By Queatrix in forum Game Programming
    Replies: 2
    Last Post: 01-23-2006, 02:39 PM
  3. Window does not work.
    By RealityFusion in forum Windows Programming
    Replies: 6
    Last Post: 10-06-2005, 09:34 AM
  4. Get Window Zorder?
    By Aidman in forum Windows Programming
    Replies: 2
    Last Post: 05-21-2003, 06:25 AM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 10:01 PM