Re: Reliable way to change the cursor
- From: "Armin Zingler" <az.nospam@xxxxxxxxxx>
- Date: Thu, 28 Jun 2007 05:14:58 +0200
"Luke R" <dont@xxxxxxx> schrieb
Am i confused or are you saying that you shouldnt use the WaitCursor
if you are using DoEvents?
Yes. DoEvents means that the user can interact with the application, whereas
a WaitCursor indicates that he can not. Therefore I would not show a
WaitCursor if I called Doevents.
It works if the ui thread is locked (i.e. running a process). But
what about if i want to write status messages to the status bar
during the process? The only way to make them display is by calling
DoEvents.
This really pisses me off.
Me too! The reason for this is that since WinXP we don't have the choice
only to OUT-put something without accepting IN-put.
But to start from the beginning: Til Win98 (or ME) you could have a busy
application (without doevents) and still update the display. We had to call
the control's Refresh method after, for example, updating a label's text.
Worked well. The user must not operate the application in this time. At
least this was our (programmer's) choice.
Since WinXP there are ghost windows: (2nd paragraph)
http://msdn2.microsoft.com/en-us/library/ms644927.aspx
This means: If we want to update the display, it is not sufficient to call
the control's Refresh method because our window might have been replaced by
a ghost window. In order to update the display we are forced to keep the
application responsive, but this means the user can also interact with the
application although we don't want this and we only want to update the
display. This can cause a lot of work because the state working+responsive
must be handled. So, we have to use Doevents (which I never use), or put
the work in a separate thread.
One day I found a workaround for this problem without using
Doevents or another thread: In addition to calling the control's Refresh
method, call the PeekMessage API function during your
process. This prevents the window from being replaced by a ghost window.
Now that I've been googling the history of this topic, I came across a
probably helpful new feature:
http://support.microsoft.com/kb/817611
I've no clue yet what it is but I'll have a look at it. Maybe it helps you
too. Seems to be a problem fixed with SP2, but the Toolkit might be interesting....
So, if you don't use Doevents anymore, you can use the Waitcursor. But, if
you want to use Doevents, don't show the Waitcursor.
Armin
Why cant things just work the way they
say they do. Especially with something as fundamental as the wait
cursor.
UseWaitCursor: "Gets or sets a value indicating whether to use the
wait cursor for the current control and all child controls."
That is false. It simply doesnt work like that.
"Armin Zingler" <az.nospam@xxxxxxxxxx> wrote in message
news:edlUhvQuHHA.4952@xxxxxxxxxxxxxxxxxxxxxxx
> "Luke R" <dont@xxxxxxx> schrieb
> > At first i thought that didnt even work at all, and then i
> > discovered that it works if you dont touch the mouse... if you
> > move the mouse one pixel in any direction it goes back to the
> > default
> > cursor for the object the cursor is over.
>
> Works here. I assumed that the WaitCursor only makes sense if the
> thread is
> busy. Then it should work. If it is not busy, or if you use
> Application.Doevents, then it does not work, but then one
> shouldn't use the WaitCursor (IMO).
>
>
> Armin
>
>
.
- Follow-Ups:
- Re: Reliable way to change the cursor
- From: Luke R
- Re: Reliable way to change the cursor
- References:
- Re: Reliable way to change the cursor
- From: Armin Zingler
- Re: Reliable way to change the cursor
- From: Luke R
- Re: Reliable way to change the cursor
- From: Armin Zingler
- Re: Reliable way to change the cursor
- From: Luke R
- Re: Reliable way to change the cursor
- Prev by Date: Re: Basic HTML in TextToolTip?
- Next by Date: Re: modfy the desktopbackground
- Previous by thread: Re: Reliable way to change the cursor
- Next by thread: Re: Reliable way to change the cursor
- Index(es):
Relevant Pages
|