The information in this article applies to:
SYMPTOMSYou have an ActiveX control created in Visual C++ using the Microsoft Foundation Classes (MFC). When two of these controls reside on different Visual Basic MDI child forms, and you attempt to switch from one form to another by clicking on the controls, focus shifts to the control, but the expected Activate/Deactivate form events do not occur. Code in the events does not run, and the Active Title Bar does not switch as expected. CAUSEWindows MDI child activation is based on the MDI client window getting the WM_PARENTNOTIFY message. A control created in MFC has a window style of WS_EX_NOPARENTNOTIFY by default. This suppresses the parent notification message, causing the problem described above. RESOLUTION
To resolve this problem, change the window style of the control. There are
two ways to accomplish this. Resolution #1 requires alteration of the
control's source code. It is the recommended solution, but does require
source code access. Resolution #2 presents a way to resolve this situation
in the Visual Basic client application. Resolution #2 has one requirement:
The control must expose an hWnd property.
Resolution #1Change the window style of the control in PreCreateWindow. This example uses a hypothetical control named CPushCtrl, derived from the button class.Sample Code
Resolution #2If it is not possible to change the code for the control, you can use the Win32 API from the Visual Basic client to change this value.
STATUSThis behavior is by design.
Keywords : kbcode kbActiveX kbMFC kbVBp500 kbVBp600 kbVC500 kbVC600 kbGrpVB |
Last Reviewed: January 5, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |