I have a VBA app which uses PostMessage to send data to an MFC app dialog.
I use PreTranslateMsg to catch the message in the MFC dialog.
What is strange is that it all works if I do not run inside the VS C++ IDE, i.e. run the MFC EXE on its own.
But if I run it from inside the IDE the message never arrives.
Fragment from the VBA app, sends the number 99 to the other EXE:
PostMessage hWndCreaColl, WM_USER + 1, 99, ByVal "LPARAM message"
Fragment from the MFC app, watches for the message:
BOOL CMainDlg::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_USER + 1) {
const int wParam = (const int)pMsg->wParam ;
const char* const pszLParam = (const char* const)pMsg->lParam ;
WalertBoxW (L"Message <%d>",wParam) ;
return TRUE ;
} else {
// The normal thing
return CDialogEx::PreTranslateMessage(pMsg);
}
}
Is there some setting in the IDE that I have to set?
TIA...
Owen