Posted on 1999-07-23
Medium Priority
Last Modified: 2013-11-20
The scenario:  I have an opening dialog, where people enter their user name and password...then, it starts up the main program in document view form.  It takes awhile to load the main program...right now the cursor looks like an edit cursor...I would like it to display the hourglass.  BeginWaitCursor, and CWaitCursor don't seem to work for this...is there a specific place I need to place one of these commands?  Or am I just out of luck?
Question by:pfaux
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Accepted Solution

Triskelion earned 100 total points
ID: 1311168
You need to make sure your events are far enough apart for the effect to take place (with the cursor).
If they are too close together, you may not see anything.
As a test, put the BeginWaitCursor(); in a function with no EndWaitCursor() and see what happens.  Then experiment around with placement of the two commands.  Also ensure you don't have any mouse cursor modification drivers/programs in place.

Author Comment

ID: 1311169
Well, here is the thing...it definetly has time to show the wait cursor...so it isn't that it just doesn't show up.  I had it so that, on okay of the dialog it would show for a brief moment, and then when the frame showed up it would show for a brief moment as well.  However, there is a long time in the middle there where it just shows the edit cursor on the computers background.  And I had tried putting the beginwaitcursor in without an end...no change.  It seems like it shifts control to something somewhere, and it doesn't display the wait there.  I just don't really know where to look.  any ideas there??  I played around with the App, and InitInstance, trying to get the wait cursor to work in there...Also in the MainListView, I played with oninitupdate.  Is there somewhere else do you think?

Expert Comment

ID: 1311170
If you read up on the use of WaitCursors you will see that calls to the GDI invalidate the current cursor state.

Either you must use BeginWaitCursor() correctly or you must avoid calls to the GDI between the times you issue the BeginWaitCursor Command, and when you wish the WaitCursor to Disappear.

The easiest way to discover if this is a problem, is to use CWaitCursor.  Simply declare a CWaitCursor object on the stack at the point you wish it to begin, and watch when it is changed back to a normal cursor.  

This will show you who is affecting the Waitcursor.

Since the CWaitCursor object will go out of scope and destroy itself, which reverts the cursor to normal, yopu will see whenter this occurs in your code or elsewhere

Author Comment

ID: 1311171
Is there an easy way to find the GDI stuff??  Because what I am doing is ONInitInstance, I am bringing up a dialog box...don't need a waitcursor until the ok button is pressed.  When that is pressed I just need the wait cursor to display until the mainview comes up...now I can see that there might be a bunch of GDI calls in there.  

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question