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. Set cursor to hourglass before window appears

Set cursor to hourglass before window appears

Scheduled Pinned Locked Moved C / C++ / MFC
question
10 Posts 5 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.
  • M Offline
    M Offline
    MeniB
    wrote on last edited by
    #1

    Hello, My application is pretty heavy. It takes about 10 seconds until it's shown to the user, until then, the user don't see a thing. I want to change the cursor to hourglass before the window is shown. BTW, my window is created, I just don't show it, until all its components are loaded. How can I implement this? I tried to use SetCursor, but when I move my mouse over the background windows it changes back to arrow right away. Thanks, Meni.

    K R S 3 Replies Last reply
    0
    • M MeniB

      Hello, My application is pretty heavy. It takes about 10 seconds until it's shown to the user, until then, the user don't see a thing. I want to change the cursor to hourglass before the window is shown. BTW, my window is created, I just don't show it, until all its components are loaded. How can I implement this? I tried to use SetCursor, but when I move my mouse over the background windows it changes back to arrow right away. Thanks, Meni.

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

      If you are using MFC, create a CWaitCursor object, it will manage the hour glass as long as the object is instantiated. { CWaitCursor waitCursor; <some lengthy operation> }


      Change of fashion is the tax levied by the industry of the poor on the vanity of the rich Fold with us! ¤ flickr

      M 1 Reply Last reply
      0
      • K KaRl

        If you are using MFC, create a CWaitCursor object, it will manage the hour glass as long as the object is instantiated. { CWaitCursor waitCursor; <some lengthy operation> }


        Change of fashion is the tax levied by the industry of the poor on the vanity of the rich Fold with us! ¤ flickr

        M Offline
        M Offline
        MeniB
        wrote on last edited by
        #3

        Sorry, it doesn't help. I'm not using MFC. I'm using win32...

        K 1 Reply Last reply
        0
        • M MeniB

          Sorry, it doesn't help. I'm not using MFC. I'm using win32...

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

          Then I guess you have to catch the WM_SETCURSOR message and set the cursor to the waitcursor according to a boolean attribute of your window - cf http://blogs.msdn.com/oldnewthing/archive/2005/05/25/421707.aspx[^]


          Change of fashion is the tax levied by the industry of the poor on the vanity of the rich Fold with us! ¤ flickr

          M 1 Reply Last reply
          0
          • M MeniB

            Hello, My application is pretty heavy. It takes about 10 seconds until it's shown to the user, until then, the user don't see a thing. I want to change the cursor to hourglass before the window is shown. BTW, my window is created, I just don't show it, until all its components are loaded. How can I implement this? I tried to use SetCursor, but when I move my mouse over the background windows it changes back to arrow right away. Thanks, Meni.

            R Offline
            R Offline
            Rajkumar R
            wrote on last edited by
            #5

            Hi, I guess your Application Window is not shown till all of the component get loaded. setCursor has effect for the window only, since the window is not actually shown, set cursor won't have effect. I think typically scenarios are handled by "Splash Screens". A simple window, its sole purpose is to give the user a feel that application has started and also it can show the progress of loading. Try Something like splash screens. Best Regards Raj

            M 1 Reply Last reply
            0
            • K KaRl

              Then I guess you have to catch the WM_SETCURSOR message and set the cursor to the waitcursor according to a boolean attribute of your window - cf http://blogs.msdn.com/oldnewthing/archive/2005/05/25/421707.aspx[^]


              Change of fashion is the tax levied by the industry of the poor on the vanity of the rich Fold with us! ¤ flickr

              M Offline
              M Offline
              MeniB
              wrote on last edited by
              #6

              The problem is that: when the window is still invisible and I set the cursor to hourglass, even if i'll alter the WM_SETCURSOR handling it won't solve it, because my window doesn't get the WM_SETCURSOR messages, because the mouse is over other windows! How can I implement it, so no matter where my cursor is, it'll show an hourglass cursor. Thanks you.

              1 Reply Last reply
              0
              • R Rajkumar R

                Hi, I guess your Application Window is not shown till all of the component get loaded. setCursor has effect for the window only, since the window is not actually shown, set cursor won't have effect. I think typically scenarios are handled by "Splash Screens". A simple window, its sole purpose is to give the user a feel that application has started and also it can show the progress of loading. Try Something like splash screens. Best Regards Raj

                M Offline
                M Offline
                MeniB
                wrote on last edited by
                #7

                Before going to splash screen strategy, where did you find that icons are applied on windows only? Can you please send a link? How about lets say capturing the mouse (or something) and then set the icon?

                I R 2 Replies Last reply
                0
                • M MeniB

                  Before going to splash screen strategy, where did you find that icons are applied on windows only? Can you please send a link? How about lets say capturing the mouse (or something) and then set the icon?

                  I Offline
                  I Offline
                  Iain Clarke Warrior Programmer
                  wrote on last edited by
                  #8

                  That doesn't really need a link - its pretty obvious in today's forced multi tasking environment. The window the mouse is over gets the WM_SETCURSOR messages. The only way to do your plan is to create a transparent window covering up the whole desktop (which can be a headache on a multimonitor system), or just simply do a splash screen. The splash screen has the advantage of being able to display some sort of progress as your application initialises bit-by-bit. Iain.

                  1 Reply Last reply
                  0
                  • M MeniB

                    Before going to splash screen strategy, where did you find that icons are applied on windows only? Can you please send a link? How about lets say capturing the mouse (or something) and then set the icon?

                    R Offline
                    R Offline
                    Rajkumar R
                    wrote on last edited by
                    #9

                    Hi, Please search for links. Simply think can you set cursor for non window application application. Mouse capture is released when the user explicitly switched to next application(for eg: pressing WINDOWS key, Alt + tab), this can happen as your application is not started in 10 seconds.

                    1 Reply Last reply
                    0
                    • M MeniB

                      Hello, My application is pretty heavy. It takes about 10 seconds until it's shown to the user, until then, the user don't see a thing. I want to change the cursor to hourglass before the window is shown. BTW, my window is created, I just don't show it, until all its components are loaded. How can I implement this? I tried to use SetCursor, but when I move my mouse over the background windows it changes back to arrow right away. Thanks, Meni.

                      S Offline
                      S Offline
                      sudheee
                      wrote on last edited by
                      #10

                      use 'BeginWaitCursor()'and 'EndWaitCursor()' between these two function calls write ur body of the function. the moment it calls the BeginWaitCursor() arrow cursor will change into hour glass and when it reaches EndWaitCursor() hour glass will change into arrow cursor. for ex: void C01Dlg::OnRelay() { BeginWaitCursor(); // //your function body // // EndWaitCursor(); } wherever you move ur mouse pointer it will be a hour glass only.. try it out. ok.. bye. -- modified at 7:48 Tuesday 26th June, 2007

                      regards sudhakar

                      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