Hi Alex, it's you again :-)
I will try that although this is not a nice solution.
Main Topics
Browse All TopicsI have an MDI application with a control bar that contains buttons for document manipulation. When I press a button for an activity that lasts some time, I want to see a wait cursor when I move the cursor back to the document window. So I put a statement
view->SetCursor( IDC_WAIT);
just before I start the lengthy calculation.
However that does not work, because when the cursor is then moved from the control bar to the document view, the program is already busy with the calculation and does not get a chance to set the cursor. It does work fine if I invoke the same command from the menu, since in this case the cursor lands on the document view as the menu is withdrawn, therefore the cursor is set before the calculation starts.
Is there a way out?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Sorry, Alex, it does not work as you put it, nevertheless I accept the answer as you pointed me to the right direction of using threads. I am programming threads in a Solaris environment for many years but I have never tried to do that in Windows/OWL.
The real solution to the problem is to use a separate thread to do the computation, and to set the cursor from the main thread, then wait for the computation thread to finish and set the cursor back.
As long as you do both in the same thread there is no point in sleeping, as there is no other thread to set the cursor in parallel.
It is still more complex than I described above. Not only creating another thread that does the computation but also returning the main thread to Windows! If you simply suspend the main thread, it is unable to draw the cursor. Only by returning to Windows you can make sure that the cursor is drawn in parallel to the computation. This creates some nasty coordination problems, i.e., when the computation is finished you need to signal the main thread that it can continue. I do that with a user message WM_USER to my document window.
Business Accounts
Answer for Membership
by: AlexVirochovskyPosted on 2000-05-29 at 07:34:27ID: 2858744
Try after SetCursor wait a bit, with help of Sleep API.
Sleep(100); 100ms ->sufficent, i hope.
And set flag MultiThread in you Project.
I hope, it helps. Alex