Re: Fixing ambiguous closed window determining situation.
Igor Tandetnik <[email protected]> Mon, 25 Nov 2013 12:37:27 -0500
| Newsgroups | gmane.comp.windows.wtl |
|---|---|
| Message-ID | <[email protected]> |
This ain't gonna work. You are pumping messages for just one window.
That means that none of its child windows, or modeless dialogs it
creates, are going to receive any messages: no painting, no mouse
clicks, nothing. It's extremely unlikely to be what you want.
What is this "ambiguous window exit situation" of which you speak? What
problem are you trying to solve, exactly?
Igor Tandetnik
On 7/19/2013 7:16 AM, offenso wrote:
> ===Commit message
>
> Make CMessageLoop::Run multithread/multiwindow compatible. If user need he could call this method with extra HWND parameter, for filtering messages.
> Purpose:
> It helps solve ambiguous window exit situation.
> Example:
> By calling obj.Run(30), we know what window closed exactly on function return. (The window has HWND 30).
>
> ===Commit diff
> Index: S:/documents/WTL/wtl/include/atlapp.h
> ===================================================================
> --- S:/documents/WTL/wtl/include/atlapp.h (revision 467)
> +++ S:/documents/WTL/wtl/include/atlapp.h (working copy)
> @@ -1136,7 +1136,7 @@
> #endif // !_ATL_NO_OLD_NAMES
>
> // message loop
> - int Run()
> + int Run(const ::HWND hwnd = NULL)
> {
> BOOL bDoIdle = TRUE;
> int nIdleCount = 0;
> @@ -1144,13 +1144,13 @@
>
> for(;;)
> {
> - while(bDoIdle && !::PeekMessage(&m_msg, NULL, 0, 0, PM_NOREMOVE))
> + while(bDoIdle && !::PeekMessage(&m_msg, hwnd, 0, 0, PM_NOREMOVE))
> {
> if(!OnIdle(nIdleCount++))
> bDoIdle = FALSE;
> }
>
> - bRet = ::GetMessage(&m_msg, NULL, 0, 0);
> + bRet = ::GetMessage(&m_msg, hwnd, 0, 0);
>
> if(bRet == -1)
> {
>
>
>
>