Microsoft KB Archive/891792

From BetaArchive Wiki

Article ID: 891792

Article Last Modified on 5/16/2007



APPLIES TO

  • Microsoft .NET Framework Software Development Kit 1.0 Service Pack 1




SYMPTOMS

In the Microsoft .NET Framework 1.1, you may have a Multiple Document Interface (MDI) program with one or more MDI child forms that are started. When you use the MdiParent.ActiveMdiChild.Name property, you may not receive a value that is correct.

CAUSE

This problem occurs because the MdiParent.ActiveMdiChild.Name property uses a cached value that is not correct.

RESOLUTION

Software update information

A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next Microsoft .NET Framework 1.1 service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:

Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

Prerequisites

The .NET Framework 1.1 Service Pack 1.

Restart requirement

You do not have to restart your computer after you apply this software update.

Software update replacement information

This software update does not replace any other software updates.

File information

The English version of this software update has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.

   Date         Time   Version        Size       File name
   ----------------------------------------------------------------------
   18-Dec-2004  01:29  1.1.4322.2055  2,056,192  System.windows.forms.dll  

WORKAROUND

To work around this problem, send a message to the MDI child form by using Platform Invocation Services (PInvoke). For example, in the MDI parent form, override the ActiveMdiChild property as described in the following code example.

using System.Runtime.InteropServices;
using System.Diagnostics;

[DllImport("user32")]
private extern static IntPtr SendMessage(HandleRef hWnd,int msg, int wparam,int lparam);
const int WM_MDIGETACTIVE = 0x0229;

public new Form ActiveMdiChild
{
get
{
Debug.Assert(this.IsMdiContainer,"This form is not an MDI container");
MdiClient mdiClient = this.Controls[0] as MdiClient;
IntPtr hWnd = SendMessage(new HandleRef(mdiClient,mdiClient.Handle),WM_MDIGETACTIVE,0,0);
Form activeWnd = null;
foreach(Form mdiChild in this.MdiChildren)
{
if(mdiChild.Handle == hWnd) {
activeWnd = mdiChild;}
}
return activeWnd;
}

}

Note Before you use the ActiveMdiChild property, we recommend that you examine the ActiveMdiChild property to determine whether the value is a null value. For example, the following code example examines the ActiveMdiChild property to determine whether the value is equal to a null value.

Form activeWnd = this.MdiParent.ActiveMdiChild;
this.Label1.Text = activeWnd != null ? activeWnd.Text : "<null>"

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

For more information about PInvoke, visit the following Microsoft Developer Network (MSDN) Web site:

For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

824684 Description of the standard terminology that is used to describe Microsoft software updates


Keywords: kbqfe kbhotfixserver kbnetframe110presp2fix kbbug kbfix KB891792