Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Finding coordinates inside a window that has been scrolled

Finding coordinates inside a window that has been scrolled

Scheduled Pinned Locked Moved C / C++ / MFC
question
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nathan Going
    wrote on last edited by
    #1

    Here’s what i am trying to do. My application call setcapture, then on the window that is clicked i would like to retrieve the coordinates inside that window. In lmousebuttondown i convert clienttoscreen, get hwnd from windowfrompoint, and then call screentoclient with the hwnd of the target window. The coordinates are the client area, but arent correct if the window is being scrolled. What can i do? Thanks

    N I 2 Replies Last reply
    0
    • N Nathan Going

      Here’s what i am trying to do. My application call setcapture, then on the window that is clicked i would like to retrieve the coordinates inside that window. In lmousebuttondown i convert clienttoscreen, get hwnd from windowfrompoint, and then call screentoclient with the hwnd of the target window. The coordinates are the client area, but arent correct if the window is being scrolled. What can i do? Thanks

      N Offline
      N Offline
      Nibu babu thomas
      wrote on last edited by
      #2

      Nathan Going wrote:

      The coordinates are the client area, but arent correct if the window is being scrolled. What can i do?

      Use GetScrollInfo, add amount scrolled(lpsi->nPos) to retrieved client co-ordinates. Hope this helps!

      Nibu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com

      1 Reply Last reply
      0
      • N Nathan Going

        Here’s what i am trying to do. My application call setcapture, then on the window that is clicked i would like to retrieve the coordinates inside that window. In lmousebuttondown i convert clienttoscreen, get hwnd from windowfrompoint, and then call screentoclient with the hwnd of the target window. The coordinates are the client area, but arent correct if the window is being scrolled. What can i do? Thanks

        I Offline
        I Offline
        Iain Clarke Warrior Programmer
        wrote on last edited by
        #3

        Just to add to the other reply. The scroll window has no actual relationship to window it is attached to. Take notepad for example. Every time you click on the up arrow on the scroll bar, the text moves by one line of text. So the amount of pixels will vary depending on the font size. Which won;t really be available to some external program. When a program uses scroll bars, and is asked to paint a window, it gets the scroll pos, and interprets that however it likes. And how they do it will be app dependent... Iain.

        Iain Clarke appears because CPallini still cares.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups