• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 473
  • Last Modified:

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?
0
pfaux
Asked:
pfaux
  • 2
1 Solution
 
TriskelionCommented:
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.
0
 
pfauxAuthor Commented:
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?
0
 
PinTailCommented:
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
0
 
pfauxAuthor Commented:
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.  
0

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.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now