Does anyone know why this happens? Hope someone cam help.
Kind regards,
Vladislav Dubov
MSG msg;
while (::GetMessage(&msg, NULL, 0, 0))
{
if (!::IsDialogMessage(hYourDialogHwnd, &msg))
{
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
}
Note that if IsDialogMessage returns true then you should not process the
message as it has already been done by the IsDialogMessage function.
"Vladislav Dubov" <du...@alliedpickfords.ru> wrote in message
news:eiqeWZKnAHA.1916@tkmsftngp04...
static LRESULT CALLBACK GetMessageProc(int nCode, WPARAM wParam, LPARAM
lParam)
{
LPMSG lpMsg = (LPMSG) lParam;
LRESULT lResult = 0;
if( (nCode >= 0) &&
PM_REMOVE == wParam &&
(lpMsg->message >= WM_KEYFIRST && lpMsg->message <= WM_KEYLAST))
{
if (! ::IsDialogMessage(pThis->m_hWnd, (LPMSG)lParam))
{
::TranslateMessage((LPMSG)lParam);
::DispatchMessage((LPMSG)lParam);
}
else
{
lpMsg->message = WM_NULL;
lpMsg->lParam = 0L;
lpMsg->wParam = 0;
}
}
return ::CallNextHookEx(hKeyboardHook, nCode, wParam, lParam);
}
It was not until I read your message that I could get the above procedure
working! The sample code in the KB article is based on MFC and is using the
PreTranslateMessage member function of the CWinApp class. I suppose
internally it expands to something similar to the code portion inside the
outer 'if' statement.
The only question I have now is whether installing a message-intercepting
hook procedure is the only solution to the problem of modeless dialog boxes
not owning the message pump by default?
Thank you for all your help.
with best regards,
Vladislav Dubov
Mike Ryan <mi...@codexia.com> wrote in message
news:Ofd95#OnAHA.1828@tkmsftngp03...
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnic...@geocities.com
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
"Vladislav Dubov" <du...@alliedpickfords.ru> wrote in message
news:eopgIXVnAHA.1396@tkmsftngp05...