FIX: Class Browser Causes System Error on Exit (167528)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 5.0, when used with:
    • the operating system: Microsoft Windows 95
  • Microsoft Visual FoxPro for Windows 5.0a, when used with:
    • the operating system: Microsoft Windows 95

This article was previously published under Q167528

SYMPTOMS

If either of the TreeView ActiveX controls in the Class Browser have focus when you press Escape to close the Class Browser, a General Protection Fault (GPF) or Invalid Page Fault occurs. This problem occurs only under Windows 95; it does not occur under Windows NT.

CAUSE

This occurs when a new version of Comctl32.ocx has been installed. This problem occurs with any version of this file dated 1/16/97 or later.

The problem actually occurs in any form using the ActiveX controls from this .ocx file if the form is released before the code associated with the ActiveX control is completed.

RESOLUTION

Follow these steps to implement an add-in for the Class Browser to fix the problem described above:

  1. Create a program named Brwescfx.prg in the root Visual FoxPro directory with the following code:
          *  Program...........: Brwescfx.prg
          *  Author............: Ken R. Levy
          *  Copyright.........: None (Public Domain)
          *  Description.......: VFP 5.0 Class Browser patch for 1-16-97
          *                      COMCTL32.OCX bug.
          *  Note:  This add-in patch only fixes GPFs that occur when pressing
          *  ESC to exit.
          *
          *  Instructions for installation:
          *  1. Save Brwescfx.prg program file above into your VFP home/root
          *     directory.
          *  2. Launch the Class Browser in VFP 5.0 and open any VCX.
          *  3. Run Barwescfx.prg to automatically register the BrwESCFx Class
          *     Browser add-in.
          *  4. No more GPFs will occur using the Class Browser when pressing
          *     ESC.
          *
    
          LPARAMETERS oSource
    
          IF TYPE("oSource")#"O" OR ISNULL(oSource)
              IF TYPE("_oBrowser")#"O" OR ISNULL(_oBrowser)
                  MESSAGEBOX("You must have the Class Browser running " + ;
                      "to register BrwESCFx.", 48,"BrwESCFx")
                  RETURN .F.
              ENDIF
              IF _oBrowser.AddIn("BrwESCFx",HOME()+"BrwESCFx","QueryUnload")
                  MESSAGEBOX("BrwESCFx has successfully been " + ;
                      "registered.",0,"BrwESCFx")
                  RETURN
              ENDIF
              MESSAGEBOX("BrwESCFx failed to be registered.",16,"BrwESCFx")
              RETURN .F.
          ENDIF
          IF NOT oSource.cAddInMethod=="QUERYUNLOAD"
              RETURN .F.
          ENDIF
          IF TYPE("_screen.ActiveForm.ActiveControl")#"O" OR ;
              LOWER(LEFT(_screen.ActiveForm.ActiveControl.Name,3))=="ole"
              oSource.lNoDefault=.T.
              oSource.cboClassType.SetFocus
              KEYBOARD "{ESC}" PLAIN
          ENDIF
          RETURN
          *  END PROGRAM: BrwESCFx.PRG
    							
  2. Launch the Class Browser in Visual FoxPro and open any VCX.
  3. Run Brwescfx.prg (created in Step 1) to automatically register the BrwESCFx Class Browser add-in.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This has been corrected in Visual FoxPro 6.0.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Launch the Class Browser and open any VCX.
  2. Click in one of the TreeView controls to ensure it has focus.
  3. Press Escape to exit the Class Browser.
If the version of Comctl32.ocx indicated in the "Cause" section above is installed, the error should occur.

Modification Type:MajorLast Reviewed:12/6/2000
Keywords:kbbug kbcode kbprb kbvfp600fix KB167528