Microsoft KB Archive/253295

= FIX: Loading and Unloading a Form Containing MSHFlexGrid Causes GDI Resource Leak =

Article ID: 253295

Article Last Modified on 5/10/2006

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Learning Edition
 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q253295



SYMPTOMS
When a form containing an MSHFlexGrid (Msflxgrd.ocx) control is loaded and unloaded, a leak in the Graphics Device Interface (GDI) system resource occurs.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This bug was corrected in Visual Basic 6.0 Service Pack 4.

To download Visual Basic 6.0 SP4, see the following Microsoft Web site:

http://msdn.microsoft.com/vstudio/sp/vs6sp4



Steps to Reproduce Behavior
 On a Microsoft Windows NT 4.0 or Microsoft Windows 2000 computer, start a new standard EXE project with a default form (Form1). From the Project menu, add another form (Form2). From the Project menu, select Components, check Microsoft Hierarchical FlexGrid Control 6.0 (SP3) (MSHFLXGD.OCX), and click OK. Add a CommandButton (Command1) to both Form1 and Form2. Place four MSHflexgrid controls on Form2.  Add the following code to Form1: Private Sub Command1_Click Form2.Show End Sub Private Sub Form_Load Command1.Caption = "Show Form2" End Sub   Add the following code to Form2: Private Sub Command1_Click Unload Me End Sub Private Sub Form_Load Command1.Caption = "Unload Me" End Sub </li> Press the F5 key to run the project.</li> Start Task Manager (CTRL+ALT+DELETE), and select the Processes tab.</li> Under the View menu, click on Select Columns, and choose GDI Objects.</li> Click the CommandButtons on Form1 and Form2 to load and unload Form2, and note that for each iteration, there is an increase in one GDI object.</li></ol>

Additional query words: memory

Keywords: kbbug kbctrl kbdevstudio kbfix kbresource kbvbp600fix KB253295

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.