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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how to change the systen cursor in my program?

how to change the systen cursor in my program?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestionlearning
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.
  • P Offline
    P Offline
    phped
    wrote on last edited by
    #1

    I wanna to do that: click a button ,then cursor changed (for example a hand cursor) ,until click somewhere again,the cursor change to normal. I do that in my application'w windows. But the cursor change to normal as soon as it move out the application's window,Why? and what can I do ? this is my code responsed WM_SETCURSOR BOOL CTestDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) { if(!m_bArrow) { //IDC_CURSOR1 is my cursor resource ::SetCursor(AfxGetApp()->LoadCursor(IDC_CURSOR1)); return TRUE; } else return CDialog::OnSetCursor(pWnd, nHitTest, message); } thank you!

    N 2 Replies Last reply
    0
    • P phped

      I wanna to do that: click a button ,then cursor changed (for example a hand cursor) ,until click somewhere again,the cursor change to normal. I do that in my application'w windows. But the cursor change to normal as soon as it move out the application's window,Why? and what can I do ? this is my code responsed WM_SETCURSOR BOOL CTestDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) { if(!m_bArrow) { //IDC_CURSOR1 is my cursor resource ::SetCursor(AfxGetApp()->LoadCursor(IDC_CURSOR1)); return TRUE; } else return CDialog::OnSetCursor(pWnd, nHitTest, message); } thank you!

      N Offline
      N Offline
      Nish Nishant
      wrote on last edited by
      #2

      The dialog window's class cursor must be null too. Nish p.s. MSDN Snip follows :- The cursor is set only if the new cursor is different from the previous cursor; otherwise, the function returns immediately. The cursor is a shared resource. A window should set the cursor shape only when the cursor is in its client area or when the window is capturing mouse input. In systems without a mouse, the window should restore the previous cursor before the cursor leaves the client area or before it relinquishes control to another window. If your application must set the cursor while it is in a window, make sure the class cursor for the specified window's class is set to NULL. If the class cursor is not NULL, the system restores the class cursor each time the mouse is moved. The cursor is not shown on the screen if the internal cursor display count is less than zero. This occurs if the application uses the ShowCursor function to hide the cursor more times than to show the cursor. Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut

      1 Reply Last reply
      0
      • P phped

        I wanna to do that: click a button ,then cursor changed (for example a hand cursor) ,until click somewhere again,the cursor change to normal. I do that in my application'w windows. But the cursor change to normal as soon as it move out the application's window,Why? and what can I do ? this is my code responsed WM_SETCURSOR BOOL CTestDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) { if(!m_bArrow) { //IDC_CURSOR1 is my cursor resource ::SetCursor(AfxGetApp()->LoadCursor(IDC_CURSOR1)); return TRUE; } else return CDialog::OnSetCursor(pWnd, nHitTest, message); } thank you!

        N Offline
        N Offline
        Nish Nishant
        wrote on last edited by
        #3

        This is my 2nd reply to your post. I think I might have mis-interpreted your question. If you want to change the windows cursor then you might want to look up :- SetSystemCursor Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut

        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