Board index » cppbuilder » Post Message Question....
Post Message Question....
2004-09-16 05:21:18 AM
I'm try to understand the use of PostMessage (with TForm and TThread).
In an application I have developed, I have a thread that puts data into a
queue (serial comms data), and then calls a PostMessage to the window to let
it know data is available.
The PostMessage is mapped to a method in the TMainForm class, and the method
takes data out of the queue, on receiving the PostMessage, and displays the
All seems to work okay, I don't have problems when its running, but
occassionally I get strange/bad behaviour on closing down.
I put some simple tracing in for the interfaces/event handlers, and what I
discovered was that when the TForm Close() event is being processed (waiting
for threads to terminate etc), the post messages were still being processed
in the appropriate method.
I wasn't expecting this. Is this correct? I know the event handlers are
effectively call backs, is this why?
If this is true, then I need to close the form down more cleanly.