FIX: Resources Lost When Loading Modal Form from ActiveX Server (257621)



The information in this article applies to:

  • Microsoft Visual Basic Learning Edition for Windows 6.0, when used with:
    • the operating system: Microsoft Windows 95
    • the operating system: Microsoft Windows 98
  • Microsoft Visual Basic Professional Edition for Windows 6.0, when used with:
    • the operating system: Microsoft Windows 95
    • the operating system: Microsoft Windows 98
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0, when used with:
    • the operating system: Microsoft Windows 95
    • the operating system: Microsoft Windows 98

This article was previously published under Q257621

SYMPTOMS

When a client loads a modal form from an ActiveX EXE server and leaves it up for an extended period of time, the server may experience a severe resource leak under Microsoft Windows 95 and Microsoft Windows 98. This behavior happens even without any user interaction with the application. If you close the modal form to shut down the server, the resource recovers. The resource loss does not occur with a non-modal form.

CAUSE

The client application is in a frozen state waiting for the modal form to go away. During this time the message queue fills up and, therefore, system resources are lowered.

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 the latest service pack for Visual Studio 6.0.

For additional information about Visual Studio service packs, click the following article numbers to view the articles in the Microsoft Knowledge Base:

194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295 HOWTO: Tell That a Visual Studio Service Pack Is Installed

To download the latest Visual Studio service pack, visit the following Microsoft Web site:

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a new ActiveX EXE project and rename it to ModalSvr. Class1 is created by default.
  2. Paste the following code in Class1:
    Public Sub ShowForm()
        Form1.Show vbModal
    End Sub
    					
  3. From the Project menu, add a new form, Form1.
  4. Save and compile the project. ModalSvr.exe is made and registered on the computer.
  5. Create a new Standard EXE project as the client. Form1 is created by default.
  6. Add one TextBox and one CommandButton to Form1.
  7. Paste the following code to the code window of Form1:
    Dim obj As Object
    Private Sub Command1_Click()
        Set obj = CreateObject("ModalSvr.Class1")
        obj.ShowForm
        Set obj = Nothing
    End Sub
    
    Private Sub Form_Load()
        Text1.Text = ""
    End Sub
    
    Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
        If Not ((KeyCode = vbKeyF4) And (Shift = vbAltMask)) Then
           Command1_Click
        End If
    End Sub
    					
  8. On the Start menu, choose Programs, choose Accessories, choose System Tools, and then choose Resource Meter. If Resource Meter is not available, on the Start menu, choose Control Panel, choose Add/Remove Programs, and then choose the Windows Setup tab to add it.
  9. Press the F5 key to run the client. Click on the TextBox and press the F4 key to launch the server and its modal form.
  10. Watch the Resource Meter and note that the System and User resources gradually go down. Closing the modal form to shut down the server recovers the resources. If you use the KeyUp event or click Command1 to launch the modal form, the leak is not as severe.

Modification Type:MinorLast Reviewed:12/12/2005
Keywords:kbBug kbfix kbResource kbVS600sp4fix kbVS600sp5fix KB257621