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. How to change cursor?

How to change cursor?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
4 Posts 3 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.
  • G Offline
    G Offline
    george ivanov
    wrote on last edited by
    #1

    I want to change cursor icon when cursor is over a button or other control. But what events have to handle when cursor come in the client area of the control and when it go out of client area? thanks

    A A 3 Replies Last reply
    0
    • G george ivanov

      I want to change cursor icon when cursor is over a button or other control. But what events have to handle when cursor come in the client area of the control and when it go out of client area? thanks

      A Offline
      A Offline
      AHawk
      wrote on last edited by
      #2

      void CMyApp::OnLButtonDown() { AfxGetApp()->DoWaitCursor(1); // 1->>display the hourglass cursor // do some lengthy processing AfxGetApp()->DoWaitCursor(-1); // -1->>remove the hourglass cursor } What you are talking about, you might have to deal with CPoint. Use CPoint to get the location of the cursor in accordance to the location of the window. When the cursor is at a certain location in the window, such as, over a button. . .an action takes place to change the cursor. I know ActiveX controls have this ability. Chech them out.

      1 Reply Last reply
      0
      • G george ivanov

        I want to change cursor icon when cursor is over a button or other control. But what events have to handle when cursor come in the client area of the control and when it go out of client area? thanks

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

        void CMyApp::OnLButtonDown() { AfxGetApp()->DoWaitCursor(1); // 1->>display the hourglass cursor // do some lengthy processing AfxGetApp()->DoWaitCursor(-1); // -1->>remove the hourglass cursor } What you are talking about, you might have to deal with CPoint. Use CPoint to get the location of the cursor in accordance to the location of the window. When the cursor is at a certain location in the window, such as, over a button. . .an action takes place to change the cursor. I know ActiveX controls have this ability. Check them out.

        1 Reply Last reply
        0
        • G george ivanov

          I want to change cursor icon when cursor is over a button or other control. But what events have to handle when cursor come in the client area of the control and when it go out of client area? thanks

          A Offline
          A Offline
          Ashok Dhamija
          wrote on last edited by
          #4

          Use the mouse move message to check whether the cursor is in the area of a control. For example, if you are using MFC, trap the ON_WM_MOUSEMOVE message and in the OnMouseMove message-handler, find the CRect area of the control (such as button) using functions such as GetDlgItem, GetWindowRect and ScreenToClient. And, then use the set cursor message (such as ON_WM_SETCURSOR) and in its handler, first check whether the cursor point is in the aforesaid CRect area of the specific control and if so, use SetCursor function to change the cursor. Regards, Ashok Dhamija _____________________________ Padam Technologies

          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