Microsoft KB Archive/939851

From BetaArchive Wiki
Knowledge Base


Article ID: 939851

Article Last Modified on 11/28/2007



APPLIES TO

  • Windows Internet Explorer 7



SYMPTOMS

Consider the following scenario. You develop an ActiveX control that is hosted in Windows Internet Explorer 7. This ActiveX control handles the WM_KILLFOCUS message. This ActiveX control also implements the IOleInPlaceActiveObject::OnFrameWindowActivate method. When a modal dialog box appears in Internet Explorer 7, you may notice that the OnFrameWindowActivate method is called after your window receives the WM_KILLFOCUS message. However, in Microsoft Internet Explorer 6, the OnFrameWindowActivate method is called before the WM_KILLFOCUS message is received.

CAUSE

This behavior occurs because of a design change in Internet Explorer 7. When a modal dialog box is opened from the ActiveX control in Internet Explorer 7, the User32.dll process sends the WM_ACTIVATE message to the top window. Then, the User32.dll process sends the WM_KILLFOCUS message to the focus window.

In Internet Explorer 6, the WM_ACTIVATE message is converted directly to call the IOleInPlaceActiveObject::OnFrameWindowActivate method. This behavior occurs because the top window is located on the same thread as the ActiveX control. However, in Internet Explorer 7, the top window is located on a different thread because each tab runs on its own thread. To safely notify the tab thread of the activation change, the top window must run a PostMessage function. Therefore, the WM_ACTIVATE message arrives later than the WM_KILLFOCUS message.

STATUS

This behavior is by design.

MORE INFORMATION

For more information about the WM_ACTIVATE message, visit the following Microsoft Web site:

For more information about the WM_KILLFOCUS message, visit the following Microsoft Web site:


Call stack information

If you use the WinDbg debugger to debug this problem in Internet Explorer 6, the call stack information may resemble the following:

IOleInPlaceActiveObjectImpl::OnFrameWindowActivate 0
  CaaOCXIE::OnKillFocus

If you use the WinDbg debugger to debug this problem in Internet Explorer 7, the call stack information may resemble the following:

  CaaOCXIE::OnKillFocus
  IOleInPlaceActiveObjectImpl::OnFrameWindowActivate 0

Keywords: kbtshoot kbbug kbfix kbpubtypekc kbexpertiseinter KB939851