Link to home
Start Free TrialLog in
Avatar of pfaux
pfaux

asked on

WaitCursor

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?
ASKER CERTIFIED SOLUTION
Avatar of Triskelion
Triskelion
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pfaux
pfaux

ASKER

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?
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
Avatar of pfaux

ASKER

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.