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. Cursor change

Cursor change

Scheduled Pinned Locked Moved C / C++ / MFC
question
6 Posts 6 Posters 1 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
    Dennis L
    wrote on last edited by
    #1

    How do I change the cursor when the mouse pointer is on a button or on a notified picture???

    K V 2 Replies Last reply
    0
    • D Dennis L

      How do I change the cursor when the mouse pointer is on a button or on a notified picture???

      K Offline
      K Offline
      KarstenK
      wrote on last edited by
      #2

      There is a message WM_SETCURSOR. Deal with in your control and your are ready.:cool: Try it @ home. (B&B)

      1 Reply Last reply
      0
      • D Dennis L

        How do I change the cursor when the mouse pointer is on a button or on a notified picture???

        V Offline
        V Offline
        vgkotha
        wrote on last edited by
        #3

        use setcursor() on focus message handler

        A 1 Reply Last reply
        0
        • V vgkotha

          use setcursor() on focus message handler

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

          Can we get a little more help on this issue. I have been trying to do this for the past week but no luck...I have four ownerdrawn windows on my main window for which I would like to use the hand cursor like in internet explorer but all I get is the stinken' arrow. Here is the code that I use. WM_MOUSEMOVE: x = LOWORD (lParam); y = HIWORD (lParam); RECT rect; GetWindowRect(hwndView, &rect); // Handle to one of the owner drawn buttons if ( ( x >= rect.left && x <= rect.right ) && ( y >= rect.bottom && y <= rect.top ) ) ShowCursor(hCursor); break; All with no luck...Is there a difference in the coordinates of the mouse and the ones received by GetWindowRect? If so shouldn't the mouse cursor appear somewhere else on the window...for me, just the stinken' arrow :((

          J 1 Reply Last reply
          0
          • A Anonymous

            Can we get a little more help on this issue. I have been trying to do this for the past week but no luck...I have four ownerdrawn windows on my main window for which I would like to use the hand cursor like in internet explorer but all I get is the stinken' arrow. Here is the code that I use. WM_MOUSEMOVE: x = LOWORD (lParam); y = HIWORD (lParam); RECT rect; GetWindowRect(hwndView, &rect); // Handle to one of the owner drawn buttons if ( ( x >= rect.left && x <= rect.right ) && ( y >= rect.bottom && y <= rect.top ) ) ShowCursor(hCursor); break; All with no luck...Is there a difference in the coordinates of the mouse and the ones received by GetWindowRect? If so shouldn't the mouse cursor appear somewhere else on the window...for me, just the stinken' arrow :((

            J Offline
            J Offline
            jhwurmbach
            wrote on last edited by
            #5

            anonymous wrote: Is there a difference in the coordinates of the mouse and the ones received by GetWindowRect? Yes! As MSDN clearly states (in the entry for WM_MOUSEMOVE):"The coordinate is relative to the upper-left corner of the client area." So a simple ClientToScreen() on the mouse coordinates should help.

            G 1 Reply Last reply
            0
            • J jhwurmbach

              anonymous wrote: Is there a difference in the coordinates of the mouse and the ones received by GetWindowRect? Yes! As MSDN clearly states (in the entry for WM_MOUSEMOVE):"The coordinate is relative to the upper-left corner of the client area." So a simple ClientToScreen() on the mouse coordinates should help.

              G Offline
              G Offline
              georgiek50
              wrote on last edited by
              #6

              Thanks for the help, finally got it working but it wasn't the screen coordinates that were the problem. I didn't pay attention to the fact that WM_MOUSEMOVE is posted TO THE WINDOW THE CURSOR IS UNDER! In my case the buttons so what I needed to do is basically subclass the window which worked great...thanks for your help...I do have another question on this if you could help me with it. Although not a tragedy, when I click on the button now the cursor changes to an arrow and then back which is fine because it is a quick change but for other buttons which invoke dialog boxes then the cursor stays into an arrow over the button where it should be a hand. Is there a way to make the cursor be a hand until it is out of the window regardless of clicking?

              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