Hello,
I would like to integrate in my application a window external MDI, to be able to dock in Microstation.
What do you mean by external application? Are you creating an in-process DLL or a stand-alone executable?
Regards, Jon Summers LA Solutions
I create an stand-alone executable, I would like to capture.
Goubier SĂ©bastien
Do you inform MicroStation about your events in window?
If not, you should... look into implementations of MFC dialogs for MicroStation.
Native dialog attached to MicroStation must inform it about focusing, commands and so on, so it can manage it.
I set a Hook :
m_hHook = ::SetWindowsHookEx( WH_GETMESSAGE, CExternalWindow_GetMsgProc, NULL, GetCurrentThreadId());
LRESULT FAR PASCAL CDodWin_GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam){ AFX_MANAGE_STATE(AfxGetStaticModuleState()); LPMSG lpMsg = (LPMSG) lParam; CWnd *pWnd; CWnd *pWndFocus = (CWnd*)mdlNativeWindow_getFocusedContent(); if (NULL != pWndFocus && pWndFocus->m_hWnd == theApp.m_hWndExternalWindox) { { ULong messageLow = lpMsg->message & 0xffff; if ( nCode >= 0 && PM_REMOVE == wParam && messageLow != WM_CHAR ) { if (WM_MOUSEACTIVATE == lpMsg->message) { pWndFocus->SetFocus(); mdlNativeWindow_onSetFocus (G_pParent, 0); } if ( WM_MOUSEMOVE == lpMsg->message || WM_LBUTTONDOWN == lpMsg->message || WM_LBUTTONUP == lpMsg->message || WM_RBUTTONDOWN == lpMsg->message || WM_RBUTTONUP == lpMsg->message || WM_MBUTTONUP == lpMsg->message ) { CPoint point; point.x = GET_X_LPARAM(lpMsg->lParam); point.y = GET_Y_LPARAM(lpMsg->lParam); mdlNativeWindow_onMouse(G_pParent, WM_MOUSEMOVE, lpMsg->wParam, point.x, point.y); } TCHAR vkey = lpMsg->wParam; /* PreTranslate mouse motion messages for tooltips */ CWinApp * pApp = AfxGetApp(); if (WM_MOUSEMOVE == lpMsg->message) { pWndFocus->SendMessage (WM_MOUSEMOVE,lpMsg->wParam,lpMsg->lParam); } else if(lpMsg->message == WM_COMMAND) { pWndFocus->SendMessage(WM_COMMAND,lpMsg->wParam,lpMsg->lParam); } if (WM_KEYFIRST <= messageLow && messageLow <= WM_KEYLAST) { if (VK_ESCAPE == lpMsg->wParam) { mdlNativeWindow_onEscapeKey (G_pParent, lpMsg); } else if (VK_F1 <= lpMsg->wParam && lpMsg->wParam <= VK_F24) { mdlNativeWindow_onFunctionKey (G_preselForm, lpMsg->message, lpMsg->wParam, lpMsg->lParam); } else if (IsDialogMessage ((HWND) pWndFocus->m_hWnd, lpMsg) != 0) { lpMsg->message = WM_NULL; lpMsg->lParam = 0; lpMsg->wParam = 0; } } } return CallNextHookEx (theApp.m_hHook, nCode, wParam, lParam); } } return 1;}
And I try also to capture:
WM_SIZE,WM_SETFOCUS,WM_KILLFOCUS,WM_MOUSEACTIVATE,WM_DESTROY,WM_SYSCOMMAND,WM_MOUSEMOVE... in the main frame of the stand alone exe, and transmit event to Microstation :
switch(event)
{
case WM_SETFOCUS:
mdlNativeWindow_onSetFocus(G_preselForm, pOldWnd->m_hWnd);
break;
case WM_KILLFOCUS:
mdlNativeWindow_onKillFocus(G_preselForm, pOldWnd->m_hWnd);
case WM_MOUSEACTIVATE: mdlNativeWindow_onMouseActivate (G_preselForm, nHitTest, message); break;
....
}
Rgds,
Goubier Sébastien
I identify where the problem came.
My stand alone app has several Childframe.
It's OK, I found the cause of my problem. These views were using a Tooltip class that created the CWnd tooltip tooltip with WS_EX_TOPMOST style. I removed this style, and now it's ok.
Answer Verified By: sebgoubier