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. changing the cursor

changing the cursor

Scheduled Pinned Locked Moved C / C++ / MFC
help
3 Posts 2 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.
  • A Offline
    A Offline
    Alex Griffing
    wrote on last edited by
    #1

    Hi! I'm trying to set the mouse to a custom cursor while it's in the client window. I made a cursor with myhcur = CreateCursor(...) I tried SetCursor(myhcur), but it got immediately changed back to the normal arrow cursor. So then I tried changing the system cursor from arrow to my custom cursor, which I did with SetSystemCursor(myhcur, 32512). I used 32512 instead of OCR_NORMAL because the compiler thought it was an undefined symbol even when I'd included winuser.h. So now I have my own custom cursor instead of the arrow and everything works great. The problem is that I can't switch back. I've tried each of hnormal = (HCURSOR) LoadImage(0, (char *) 32512/*OCR_NORMAL*/, IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE); and hnormal = LoadCursor(0, IDC_ARROW); But when I try to set these back when my program ends, SetSystemCursor(hnormal, 32512) returns no error but doesn't change the cursor back. :)...:confused:...:((...:mad:

    L 1 Reply Last reply
    0
    • A Alex Griffing

      Hi! I'm trying to set the mouse to a custom cursor while it's in the client window. I made a cursor with myhcur = CreateCursor(...) I tried SetCursor(myhcur), but it got immediately changed back to the normal arrow cursor. So then I tried changing the system cursor from arrow to my custom cursor, which I did with SetSystemCursor(myhcur, 32512). I used 32512 instead of OCR_NORMAL because the compiler thought it was an undefined symbol even when I'd included winuser.h. So now I have my own custom cursor instead of the arrow and everything works great. The problem is that I can't switch back. I've tried each of hnormal = (HCURSOR) LoadImage(0, (char *) 32512/*OCR_NORMAL*/, IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE); and hnormal = LoadCursor(0, IDC_ARROW); But when I try to set these back when my program ends, SetSystemCursor(hnormal, 32512) returns no error but doesn't change the cursor back. :)...:confused:...:((...:mad:

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Handle WM_SETCURSOR and call SetCursor() in response to that message. --Mike-- http://home.inreach.com/mdunn/ "Holding the away team at bay with a non-functioning phaser was an act of unmitigated gall. I admire gall."   -- Lt. Cmdr. Worf

      A 1 Reply Last reply
      0
      • L Lost User

        Handle WM_SETCURSOR and call SetCursor() in response to that message. --Mike-- http://home.inreach.com/mdunn/ "Holding the away team at bay with a non-functioning phaser was an act of unmitigated gall. I admire gall."   -- Lt. Cmdr. Worf

        A Offline
        A Offline
        Alex Griffing
        wrote on last edited by
        #3

        Thanks, I just finally found that. I guess DefWindowProc was the culprit that kept changing the cursor back!

        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