Re: PostMessage and unprocessed messages
"Joseph M. Newcomer" <newcomer@flounder.com> ha scritto nel messaggio
news:dik6t3piblv1a0nons3fvjui0gkvc4opsu@4ax.com...
// ... in WinMain (or somewhare in dialog parent)
MessageMemoryManager mgr;
****
You would not declare this in WinMain, because it would then be scoped to
that function.
It is then logically a "global" variable.
If the only thing that the app does is displaying a dialog-box, the code
that creates and runs the dialog-box is in WinMain.
I need the memory manager to live in a context "external" to the dialog-box,
so I put that in WinMain.
malloc/new work remarkably well without the complexity
I need to do something like "Remove all allocated (pending) message heap
data" when the dialog-box closes.
It is not possible with "raw" new/delete.
I need to store somewhere the pointers created with new, and keep track of
them, so I can delete them when I need, calling MemoryManager.Clear().
What happens when MessageMananger::New fails?
MessageManager::New uses 'new' internally.
So, if new fails, I think std::bad_alloc exception is thrown.
Giovanni