Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

You receive a WM_ACTIVATE message after you receive a WM_KILLFOCUS message in Internet Explorer 7


View products that this article applies to.

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.

↑ Back to the top


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.

↑ Back to the top


Status

This behavior is by design.

↑ Back to the top


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

↑ Back to the top


Keywords: KB939851, kbexpertiseinter, kbpubtypekc, kbfix, kbbug, kbtshoot

↑ Back to the top

Article Info
Article ID : 939851
Revision : 4
Created on : 11/28/2007
Published on : 11/28/2007
Exists online : False
Views : 271