Hi, one question: If I want my C++ MFC PlugIn want to receive Windows messages, I need to add a PreTranslateMessage function to my PlugInApp.cpp. But unfortunately it is never called… Do I need to do something aditional (e.g. a message hook) ? many thanks Peter
For modeless dialogs, this is true.
What are you working on?
– Dale
Hi Dale, thanks for the quick answer.
My Plugin has no dialog, but wants to bring something up like a 3D handle. To modify this, I need access to Mouse Move, Mouse key events etc.
I remember in earlier software we did this using PreTranslateMessage, but maybe there was a trick. I tried already to use the macro
AFX_MANAGE_STATE( AfxGetStaticModuleState() );
but my local PreTranslateMessage function is still ot called.
Thanks
Peter
Hi Peter,
Overriding PreTranslate on your CWinApp-derived object is the wrong location. First, a CWinApp, in DLL, has no hWnd. CWinApp does contains a message pump. But you are running in a DLL so the main message pump is in Rhino.
You’ll need to create hidden window and send messages to that window. Make it a child of the main Rhino window.
Let me know if you need an example.
– Dale
Many thanks.
And yes, a small example would be great!
Dale,
I think I got it! I added a dummy dialog (see below), now I receive messages.
many thanks
m_TranslateMessage_dlg = new CRhinoUiDialog();
if (!m_TranslateMessage_dlg->Create(IDD_DUMMY_DIALOG))
{
delete m_TranslateMessage_dlg;
m_TranslateMessage_dlg = NULL;
return false;
}
.
.
.