FIX: GPF When Close Form That Contains a Single MCI Control

Last reviewed: October 30, 1997
Article ID: Q95500
1.00 2.00 3.00 WINDOWS kbprg kbbuglist

The information in this article applies to:

- Standard and Professional Editions of Microsoft Visual Basic for

  Windows, versions 2.0 and 3.0
- Microsoft Visual Basic programming system for Windows, version 1.0

SYMPTOMS

When you have a single MCI control on a form and you set the hWndDisplay property to the form's hWnd, you will receive a general protection (GP) fault upon closing Form1 through the System Control of Form1. This problem does not occur when you have a second control on Form1 in which you set the HwndDisplay property to the hWnd of the other control.

WORKAROUND

Here's an example that shows how to work around the problem. The code listed below places a picture box on Form1, changes the BoarderStyle to '0' (None), and then places an MCI control on Form1:

   Sub Form_Load()
      MMControl1.FileName = "c:\vb\samples\mci\mcitest.mmm"
        '** file in the ..\samples\mci directory of VB 2.0
      MMControl1.hWndDisplay = Picture1.hWnd
        '** note the picture's hWnd is used in place of the form's.
      MMControl1.Command = "Open"
   End Sub

   Sub Form_Unload()
      MMControl1.Command = "Close"
   End Sub

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem has been corrected in Visual Basic version 4.0.

MORE INFORMATION

Steps to Reproduce Problem

  1. Start VB.EXE.

  2. Choose Add File... from the File menu and add the MCI.VBX file.

  3. Place an MCI control on Form1.

  4. Place the following code in the Form_Load event procedure of Form1:

       Sub Form_Load()
          MMControl1.FileName = "c:\vb\samples\mci\mcitest.mmm"
             '** file in the ..\samples\mci directory of VB 2.0
          MMControl1.hWndDisplay = Form1.hWnd
             '** docerr DisplayHwnd on page 248 of Professional Features
          MMControl1.Command = "Open"
       End Sub
    
    

  5. Place the following code in Form_Unload event of Form1:

       Sub Form_Unload()
          MMControl1.Command = "Close"
       End Sub
    
    

  6. Press the F5 key to run the example, which may result in a GP fault when you try to close Form1's System Control box. The GP fault address is 0001:2817.

Note this example and any example of using the MCI control can be run only in Windows version 3.1 or in Windows version 3.0 with Multimedia Extensions. You need add the following line to the Multimedia Extensions section ([mci extensions]) of your WIN.INI file:

   MMM=MMMovie


Additional reference words: buglist1.00 buglist2.00 buglist3.00
fixlist4.00 1.00 2.00 3.00
KBCategory: kbprg kbbuglist
KBSubcategory: PrgCtrlsCus
Keywords : PrgCtrlsCus kbbuglist kbprg
Version : 1.00 2.00 3.00
Platform : WINDOWS
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.