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. SetCursor Problems !

SetCursor Problems !

Scheduled Pinned Locked Moved C / C++ / MFC
questionvisual-studio
6 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.
  • K Offline
    K Offline
    Koep
    wrote on last edited by
    #1

    Hi again, i call SetCursor(LoadCursor(NULL, IDC_WAIT)) in a (ListCtrl) Subroutine, but the Cursor doesn't change. How can i make it the right way ? Win2000 Prof, VS 6.0, SP2 Marco

    C 1 Reply Last reply
    0
    • K Koep

      Hi again, i call SetCursor(LoadCursor(NULL, IDC_WAIT)) in a (ListCtrl) Subroutine, but the Cursor doesn't change. How can i make it the right way ? Win2000 Prof, VS 6.0, SP2 Marco

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      to change the cursor, you need to handle the WM_SETCURSOR message. this will give you a OnSetCursor function. like this:

      BOOL CPickAxeView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
      {
      // make sure we only set the cursor if we're need to
      if (pWnd==(CWnd *)this)
      {
      if (nHitTest==HTCLIENT)
      {
      if (message==WM_MOUSEMOVE)
      {
      SetCursor(AfxGetApp()->LoadStandardCursor(m_cursor));
      return TRUE;
      }
      }
      }

      return CView::OnSetCursor(pWnd, nHitTest, message);
      

      }

      -c


      To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses.
         /. #3848917

      Thumbnail galleries?

      K 1 Reply Last reply
      0
      • C Chris Losinger

        to change the cursor, you need to handle the WM_SETCURSOR message. this will give you a OnSetCursor function. like this:

        BOOL CPickAxeView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
        {
        // make sure we only set the cursor if we're need to
        if (pWnd==(CWnd *)this)
        {
        if (nHitTest==HTCLIENT)
        {
        if (message==WM_MOUSEMOVE)
        {
        SetCursor(AfxGetApp()->LoadStandardCursor(m_cursor));
        return TRUE;
        }
        }
        }

        return CView::OnSetCursor(pWnd, nHitTest, message);
        

        }

        -c


        To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses.
           /. #3848917

        Thumbnail galleries?

        K Offline
        K Offline
        Koep
        wrote on last edited by
        #3

        Thanxs, i needed for the header of a listcontrol. If the cursor is over the header, then the standard cursor is shown. How can i catch the Listcontrol->Header->OnSetCursor routine ? Marco

        C 1 Reply Last reply
        0
        • K Koep

          Thanxs, i needed for the header of a listcontrol. If the cursor is over the header, then the standard cursor is shown. How can i catch the Listcontrol->Header->OnSetCursor routine ? Marco

          C Offline
          C Offline
          Chris Losinger
          wrote on last edited by
          #4

          you'll need to create a class derived from CHeaderCtrl, override OnSetCursor there, then use that class on your list control. -c


          To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses.
             /. #3848917

          Thumbnail galleries?

          K 1 Reply Last reply
          0
          • C Chris Losinger

            you'll need to create a class derived from CHeaderCtrl, override OnSetCursor there, then use that class on your list control. -c


            To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses.
               /. #3848917

            Thumbnail galleries?

            K Offline
            K Offline
            Koep
            wrote on last edited by
            #5

            Hi, sorry for my stupid question, but how can i "use that class on your list control" ? i have a created a new Class with modified OnSetCursor(), and then... ? Marco

            K 1 Reply Last reply
            0
            • K Koep

              Hi, sorry for my stupid question, but how can i "use that class on your list control" ? i have a created a new Class with modified OnSetCursor(), and then... ? Marco

              K Offline
              K Offline
              Koep
              wrote on last edited by
              #6

              Hi, i will try the "Using the Header Control" Stuff first. The magic word is "subclassing". Marco

              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