Knowledge Base

FIX: Command Line Compile Fails with MFC ActiveX Control

Article ID: 190196

Article Last Modified on 11/18/2003


APPLIES TO


This article was previously published under Q190196

SYMPTOMS

When compiling a Microsoft Visual Basic project from a command line, the following error may occur:
The instruction at "0x00000000" referenced memory at "0x00000000". The memory could not be "read".
However, the project does compile successfully from the Visual Basic IDE (Integrated Development Environment.)

CAUSE

An ActiveX Control used within the project does not have a default Icon resource.

RESOLUTION

You must include a Bitmap resource in each ActiveX control used in the project.

STATUS

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

MORE INFORMATION

Steps to Reproduce Behavior

  1. In Microsoft Visual C++ 5.0, create a new MFC ActiveX Control Wizard project with all the default selections. Name this project TestControl.
  2. Click the ResourceView tab in the Workspace Window. There should be Bitmap Resource containing the default "OCX" bitmap.
  3. Double-click the Bitmap Resource, and delete the Bitmap entry.
  4. From the Build menu, click Build TestControl.ocx.
  5. Start Microsoft Visual Basic, creating a Standard EXE project.
  6. From the Project menu, click Components.
  7. Check the TestControl ActiveX Control Module entry, and click OK.
  8. Site the TestControl onto the default form (Form1).
  9. Save the project, and compile it within the IDE.

    NOTE: The project should compile with no errors.
  10. Shell out to MS-DOS, and attempt to compile the project through the command line parameters. For example:
          VB5.EXE /M C:\TestProject\Project1.VBP
    						
    NOTE: The Microsoft Visual Basic directory should be included in the environment path or a command line compile will not work. Proper quotation marks should be used if the path contains long filenames.

    The following error message will be displayed:
    The instruction at "0x00000000" referenced memory at "0x00000000". The memory could not be "read".

Additional query words: kbDSupport kbVC kbdsd kbVBp500bug kbVBp600fix kbCompiler

Keywords: kbbug kbfix KB190196