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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Keep the cursor inside a window

Keep the cursor inside a window

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.
  • D Offline
    D Offline
    Daniela123
    wrote on last edited by
    #1

    My program has a virtual screen, many times larger than the real screen. In order to navigate on the virtual screen, I use scroll-bars. However I do not like that. I want, that when I move the cursor/mouse to the edge of my window, the window "pans" in the desired direction, and my cursor is re-located to the middle of my window. I know, that this is against "the grain" of windows, because I would imprison the cursor inside my window until I exit my application.... but this is what I want. Anybody...? Thanks Daniela

    M A 2 Replies Last reply
    0
    • D Daniela123

      My program has a virtual screen, many times larger than the real screen. In order to navigate on the virtual screen, I use scroll-bars. However I do not like that. I want, that when I move the cursor/mouse to the edge of my window, the window "pans" in the desired direction, and my cursor is re-located to the middle of my window. I know, that this is against "the grain" of windows, because I would imprison the cursor inside my window until I exit my application.... but this is what I want. Anybody...? Thanks Daniela

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      Check out ClipCursor() --Mike-- Latest blog entry: *drool* (Alyson) [May 10] Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber "You have Erica on the brain" - Jon Sagara to me

      1 Reply Last reply
      0
      • D Daniela123

        My program has a virtual screen, many times larger than the real screen. In order to navigate on the virtual screen, I use scroll-bars. However I do not like that. I want, that when I move the cursor/mouse to the edge of my window, the window "pans" in the desired direction, and my cursor is re-located to the middle of my window. I know, that this is against "the grain" of windows, because I would imprison the cursor inside my window until I exit my application.... but this is what I want. Anybody...? Thanks Daniela

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        The basic approach to this is to SetCapture() on the window you want to stay in. Then scroll it when the mouse moves outside its boundaries. Remember to ReleaseCapture() when you are finished

        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