Microsoft KB Archive/192653

From BetaArchive Wiki
Knowledge Base


Article ID: 192653

Article Last Modified on 3/3/2005



APPLIES TO

  • Microsoft Visual Basic 6.0 Learning Edition
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic 6.0 Enterprise Edition



This article was previously published under Q192653

SYMPTOMS

A Visual Basic project group contains at least eight ActiveX DLL projects and one standard EXE project. The Standard EXE project creates and releases the ActiveX DLL files. The project group is compiled into DLL and EXE files. The EXE file is run.

The first time you create and release the ActiveX DLL files, the program runs successfully. However, the second time you create and release the ActiveX DLL files, an application error occurs and displays the following message:

The instruction at "0x6602c2c5 referenced memory at "0x010b008c". The Memory could not be "written".

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 Studio 6.0 Service Pack 3. For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:

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

194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed


MORE INFORMATION

The bug occurs only when the compiled projects are run outside the Visual Basic IDE. The bug does not occur when you run the project through the Visual Basic IDE.

This section shows you how to create a sample project that demonstrates the bug behavior. The section assumes you are familiar with creating ActiveX DLL projects, standard EXE projects, project groups, and compiling these files into a executable file.

Steps to Reproduce Behavior

The sample project contains eight ActiveX DLL projects that will be used in a Standard EXE project. The Standard EXE project is then compiled into an executable file. The executable file is then run to demonstrate the bug behavior.

To create the eight ActiveX DLL projects:

  1. Start a new ActiveX DLL project in Visual Basic. Class1 is created by default.
  2. Copy the following code to the Code window of the Class1:

    Option Explicit
          Public Sub DoNothing()
    
          End Sub
                        
  3. Save this Class module as Class1.cls and this project as Project1.vbp.
  4. Add another ActiveX DLL project to the project group. Class1 is created by default. Remove the Class1 class module from this project and add the Class1 class module you created for Project1.vbp to the new ActiveX DLL project.
  5. Save this project as Project2.vbp.
  6. Repeat steps 4 and 5 to add six other ActiveX DLL projects with the same Class1 class module to the project group. Save these projects as Project3.vbp through Project8.vbp.

    You have just created a project group with eight ActiveX DLL projects saved as Project1.vbp to Project8.vbp. Each ActiveX DLL project references the same Class1 class module created in Project1.vbp.

    The next step is to create a Standard EXE project that uses the eight ActiveX DLL projects.

To create the Standard EXE project:

  1. Add a new Standard EXE project to the same project group containing the eight ActiveX DLL projects. Form1 is created by default.
  2. Add a CommandButton to Form1.
  3. Copy the following code to the Code window of the Form1 form:

          Option Explicit
    
          Private Sub Command1_Click()
             Dim o(8) As Object
             Dim i As Integer
             Dim strProgID As String
    
             For i = 1 To 8
                strProgID = "Project" & i & ".Class1"
                Set o(i) = CreateObject(strProgID)
                o(i).donothing
                Set o(i) = Nothing
             Next
             MsgBox "Done"
          End Sub
                        
  4. Save the project as Project9.vbp.
  5. Set Project9.vbp as the Start up project. In the Project Explorer, right-click Project9.vbp and then click Set as Start Up. Project9.vbp appears in bold in the Project Explorer.
  6. Press the F5 key to start to run the project in IDE. Click the Command1 button in Form1 several times and it note that it works correctly.
  7. Compile the Project Group.
  8. Run Project9.exe outside the IDE. The Form1 form appears. Click Command1. A message box appears. Click OK to close the message box. Click Command1 again. Note that an application error occurs and displays the following message box:

    The instruction at "0x6602c2c5 referenced memory at "0x010b008c". The Memory could not be "written".



Additional query words: COM ActiveX InProc

Keywords: kbbug kbfix kbide kbvs600sp1fix kbdll kbvs600sp2fix kbvs600sp3fix KB192653