G
Guest
I have a problem with keyboard navigation using winforms and an MFC based
host application. Do you see any problems calling PreProcessMessage as a
work around?
Here is the solution I came up with:
// override CWinApp:reTranslateMessage
bool HandleMessage(MSG* pMsg);
BOOL CMfcHostDialogApp:reTranslateMessage(MSG* pMsg)
{
if (HandleMessage(pMsg))
return TRUE;
return CWinApp:reTranslateMessage(pMsg);
}
// attempt to handle messages for managed controls
using namespace System;
using namespace System::Windows::Forms;
bool HandleMessage(MSG* pMsg)
{
if (pMsg != NULL && pMsg->hwnd != NULL)
{
Control^ control = Control::FromHandle(IntPtr(pMsg->hwnd));
if (control != nullptr)
return control->PreProcessMessage(Message::Create(IntPtr(pMsg->hwnd),
pMsg->message, IntPtr((void*)pMsg->wParam), IntPtr(pMsg->lParam)));
}
return false;
}
// end sample code
I can send a full sample solution if necessary.
host application. Do you see any problems calling PreProcessMessage as a
work around?
Here is the solution I came up with:
// override CWinApp:reTranslateMessage
bool HandleMessage(MSG* pMsg);
BOOL CMfcHostDialogApp:reTranslateMessage(MSG* pMsg)
{
if (HandleMessage(pMsg))
return TRUE;
return CWinApp:reTranslateMessage(pMsg);
}
// attempt to handle messages for managed controls
using namespace System;
using namespace System::Windows::Forms;
bool HandleMessage(MSG* pMsg)
{
if (pMsg != NULL && pMsg->hwnd != NULL)
{
Control^ control = Control::FromHandle(IntPtr(pMsg->hwnd));
if (control != nullptr)
return control->PreProcessMessage(Message::Create(IntPtr(pMsg->hwnd),
pMsg->message, IntPtr((void*)pMsg->wParam), IntPtr(pMsg->lParam)));
}
return false;
}
// end sample code
I can send a full sample solution if necessary.