I have a problem with an ActiveX control getting mouse events - even when it's hidden. I'm no expert on COM/ActiveX - I would be MOST grateful if anybody could help me!

My application is an MFC MDI-application - with several MDI child windows. In one type of window, an ActiveX control (written in VB) is used. Sometimes it gets hidden behind another, newly created, MDI child window. The new window is active and has focus (and receives keyboard input), but the hidden ActiveX control still gets the users first click in the overlapping window!

This is a problem - users have clicked in (as they thought) the new child, but actually changed data in the ActiveX control.

I've traced the messages. I log WM_LBUTTONDOWN with something like this in CWinApp:

BOOL CMyApp::PreTranslateMessage(MSG *pMsg)
if (pMsg->message == WM_LBUTTONDOWN) {
TRACE("hwnd: %08x ", (DWORD) pMsg->hwnd);
TRACE("from pt: %08x\n", (DWORD) WindowFromPoint (pMsg->pt));
return CWinApp::PreTranslateMessage(pMsg);

The two HWND are identical for all mouse clicks, EXCEPT the first click in the new window. "WindowFromPoint" returns the correct windows (the new, overlapping one), but "pMsg->hwnd" points to the hidden ActiveX window (where the message is routed).

Any ideas? Windows/MFC knows about the new window and it has focus. Howcome the click is sent to the hidden window behind?