DetailPage-MSS-KB

Microsoft small business knowledge base

Article ID: 894500 - Last Review: February 2, 2006 - Revision: 2.2

INTRODUCTION

You may experience resource limitation issues in Microsoft Windows Forms-based applications if the applications are built on the Microsoft .NET Framework 1.0 or on the .NET Framework 1.1. These resource limitation issues may occur when you run these applications on Microsoft Windows 9x-based operating systems. The following are the Windows 9x-based operating systems:
  • Windows 98
  • Windows 98 Second Edition
  • Windows Millennium Edition
Developers and application designers should consider the differences between the way that resources are handled in the Windows 9x-based operating systems and the way that resources are handled in the Windows NT-based operating systems. The following are the Windows NT-based operating systems:
  • Windows NT 4.0
  • Windows 2000
  • Windows XP
  • Windows Server 2003

MORE INFORMATION

The .NET Framework 1.0 supports Windows 9x-based operating systems to their limits. The .NET Framework 1.1 supports the Windows NT-based operating systems to their limits. However, the limits for the operating systems are different. Therefore, if you design and build a Windows Forms-based application on a Windows NT-based computer, and then you deploy and run the application on a Windows 9x-based computer, the application may experience resource limitation issues.

When you stress-test these applications, you may receive the Win32 API "Error creating window handle" error message. Windows NT-based computers are limited to 10,000 Graphics Device Interface (GDI) handles per process. Windows 9x-based computers are limited to only 1,200 GDI handles for the whole system. In some versions of Windows, the limit is 640 GDI handles, and all applications must share these GDI handles. For example, the Japanese version of Windows Millennium Edition has a limit of 640 GDI handles. This problem may also occur in unmanaged C language-based applications.

To minimize the effect of the resource limitations, use one or more of the following methods:
  • Make sure that you create only graphical controls that will be rendered. Fewer resources are available to applications when you allocate resources to hidden controls or to arrays of controls.
  • Be careful when you use graphical objects such as pens and brushes that allocate GDI handles. The .NET Framework 1.0 and the .NET Framework 1.1 do not always release their resources until the Dispose method is called.
  • Force garbage collection before new GDI objects are allocated. To force garbage collection, call the Dispose method for objects that you do not need. Later, you can call the GC.Collect method and the GC.WaitForPendingFinalizers method to force cleanup of those objects and to release those objects. We do not recommend this method for Windows NT-based systems. However, you may have to use this method to work around the resource limitations of the Windows 9x-based operating systems.

APPLIES TO
  • Microsoft Visual Studio 2005 Standard Edition
  • Microsoft Visual Studio 2005 Professional Edition
  • Microsoft Visual Studio .NET 2003 Enterprise Architect
  • Microsoft Visual Studio .NET 2003 Enterprise Developer
  • Microsoft Visual Studio .NET 2003 Academic Edition
  • Microsoft Visual Studio .NET 2002 Professional Edition
  • Microsoft Visual Studio .NET 2002 Enterprise Architect
  • Microsoft Visual Studio .NET 2002 Enterprise Developer
  • Microsoft Visual Studio .NET 2002 Academic Edition
Keywords: 
kbvs2005swept kbvs2005applies kbwindowsforms kbinfo KB894500
Share
Additional support options
Ask The Microsoft Small Business Support Community
Contact Microsoft Small Business Support
Find Microsoft Small Business Support Certified Partner
Find a Microsoft Store For In-Person Small Business Support