In a CView derived class I have a method that posts messages to the view.
The method is intended to be used by worker threads that require the view to
perform certain actions (e.g. update screen, open/close ActiveX control,
etc.). The view has an assoc. message handler that acts on worker threads
requests. The pseudo-code is as follows:
// Called by a worker thread (i.e. non-UI thread)
/* ... */
PostMessage(WM_USER, wParam, lParam);
// Message handler (main UI thread)
/* .. */
The problem I've run into is that OnUser() is sometimes called recursively.
One example would be when PeformAction() is called while OnUser() is still
acting (e.g. destroying an ActiveX control) on a previously posted message.
It looks like destroying a control in OnUser() can trigger the view's
message queue to be emptied which in turn ends up calling OnUser() handler.
Could someone please explain why this is happening or point me to a specific
doc that describes it?