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. not stops Wait Cursor - why?

not stops Wait Cursor - why?

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

    In that code Wait cursor not stops appearing, even EndWaitCursor() callled, (until I move mouse) CFromview::Method() { BeginWaitCursor(); WORK(); EndWaitCursor(); this->Invalidate(); this->UpdateWindow(); } Why ? how to correct

    D K G 3 Replies Last reply
    0
    • V vgrigor

      In that code Wait cursor not stops appearing, even EndWaitCursor() callled, (until I move mouse) CFromview::Method() { BeginWaitCursor(); WORK(); EndWaitCursor(); this->Invalidate(); this->UpdateWindow(); } Why ? how to correct

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Is CFromview::Method() called frequently?


      Five birds are sitting on a fence. Three of them decide to fly off. How many are left?

      V 1 Reply Last reply
      0
      • D David Crow

        Is CFromview::Method() called frequently?


        Five birds are sitting on a fence. Three of them decide to fly off. How many are left?

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

        Only once. Problem probable happen when it finished until, butoon is relalized. ::SetCursor(AfxGetApp()->LoadStandardCursor (IDC_ARROW )); can help. Cursor probably not refreshed due to unknown reason, when standard Wait/End sequence is proceed.

        1 Reply Last reply
        0
        • V vgrigor

          In that code Wait cursor not stops appearing, even EndWaitCursor() callled, (until I move mouse) CFromview::Method() { BeginWaitCursor(); WORK(); EndWaitCursor(); this->Invalidate(); this->UpdateWindow(); } Why ? how to correct

          K Offline
          K Offline
          KaRl
          wrote on last edited by
          #4

          If you use MFC, you could use a CWaitCursor object:

          CFromview::Method()
          {
              {
                  CWaitCursor waitCursor;
                  WORK();
              }
              RedrawWindow();
          }
          

          HTH, K.


          Silence Means Death Stand On Your Feet Inner Fear Your Worst Enemy

          V 1 Reply Last reply
          0
          • K KaRl

            If you use MFC, you could use a CWaitCursor object:

            CFromview::Method()
            {
                {
                    CWaitCursor waitCursor;
                    WORK();
                }
                RedrawWindow();
            }
            

            HTH, K.


            Silence Means Death Stand On Your Feet Inner Fear Your Worst Enemy

            V Offline
            V Offline
            vgrigor
            wrote on last edited by
            #5

            Works same. In usual method- yes, in this - no any difference in problem.

            K 1 Reply Last reply
            0
            • V vgrigor

              Works same. In usual method- yes, in this - no any difference in problem.

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

              It sounds like something else is setting the cursor, then. You could also try to catch WM_SETCURSOR, and use a boolean set to true when your application is working: BOOL CMyView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) { if(m_bMyAppIsWorking){ ::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT)); return TRUE; } ::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); return CView::OnSetCursor(pWnd, nHitTest, message); }


              Silence Means Death Stand On Your Feet Inner Fear Your Worst Enemy

              V 1 Reply Last reply
              0
              • K KaRl

                It sounds like something else is setting the cursor, then. You could also try to catch WM_SETCURSOR, and use a boolean set to true when your application is working: BOOL CMyView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) { if(m_bMyAppIsWorking){ ::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT)); return TRUE; } ::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); return CView::OnSetCursor(pWnd, nHitTest, message); }


                Silence Means Death Stand On Your Feet Inner Fear Your Worst Enemy

                V Offline
                V Offline
                vgrigor
                wrote on last edited by
                #7

                Please explain what nature of error that was happen? First is need to understand fully, than to solve by try and error.

                K 1 Reply Last reply
                0
                • V vgrigor

                  Please explain what nature of error that was happen? First is need to understand fully, than to solve by try and error.

                  K Offline
                  K Offline
                  KaRl
                  wrote on last edited by
                  #8

                  In the example I gave, the processing of WM_SETCURSOR by the view leads to set the cursor either at IDC_WAIT or at IDC_CROSS, whatever another part of your code set the waitCursor. vgrigor wrote: First is need to understand fully, than to solve by try and error IMHO, not always, sometimes it doesn't worth the time to learn it.


                  Silence Means Death Stand On Your Feet Inner Fear Your Worst Enemy

                  V 1 Reply Last reply
                  0
                  • V vgrigor

                    In that code Wait cursor not stops appearing, even EndWaitCursor() callled, (until I move mouse) CFromview::Method() { BeginWaitCursor(); WORK(); EndWaitCursor(); this->Invalidate(); this->UpdateWindow(); } Why ? how to correct

                    G Offline
                    G Offline
                    GeMe_Hendrix
                    wrote on last edited by
                    #9

                    Ensure that in your WORK() method nothing is trying to steal the capture of the mouse. Check for SetCapture() API calls.

                    1 Reply Last reply
                    0
                    • K KaRl

                      In the example I gave, the processing of WM_SETCURSOR by the view leads to set the cursor either at IDC_WAIT or at IDC_CROSS, whatever another part of your code set the waitCursor. vgrigor wrote: First is need to understand fully, than to solve by try and error IMHO, not always, sometimes it doesn't worth the time to learn it.


                      Silence Means Death Stand On Your Feet Inner Fear Your Worst Enemy

                      V Offline
                      V Offline
                      vgrigor
                      wrote on last edited by
                      #10

                      Of course, Worth - when it is possible. It is usually (or often ) possible - to understand something, than only try and error. that is often proposed.

                      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