Microsoft KB Archive/171209

= BUG: Pop-up Menus May Cause Application Error in IDE =

Article ID: 171209

Article Last Modified on 5/13/2003

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition
 * Microsoft Visual Basic 5.0 Control Creation Edition
 * Microsoft Visual Basic 5.0 Learning Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition

-



This article was previously published under Q171209



SYMPTOMS
When working in the Microsoft Visual Basic IDE, you may receive one of the following messages:

In Visual Basic 5.0:

"Application Error:

The instruction at "0x0f019262" references memory at "0x00000000".

The memory could not be "read."

In Visual Basic 6.0:

The instruction at "0x0f039a7d" referenced memory at "0x00835006". The memory could not be "read".

This occurs when testing applications in the Visual Basic IDE that pass menus to custom ActiveX controls.



RESOLUTION
The error does not occur once the container application is compiled.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.



Steps to Reproduce Behavior
  In a new ActiveX Control project, add the following code to the control: Option Explicit

Dim oMnu As Object

Private Sub UserControl_MouseDown _ (Button As Integer, Shift As Integer, X As Single, Y As Single) Select Case Button Case vbRightButton If Not oMnu Is Nothing Then PopupMenu oMnu End If         End Select End Sub

Public Sub newMenu(mnu As Object) Set oMnu = mnu End Sub

 Name the control "PopupMenuCtl." Name the control project by clicking Project Properties from the Project menu. Set the Project Name field to "TestControl" (without the quotes). Save the project and compile the control. In a new Standard EXE project, add the control to the project by clicking Component from the Project menu and turn on the option for the new control called "TestControl." In Form1, draw an instance of TestControl.</li>  Add a menu to the form by displaying the form and selecting Menu Editor from the Tools menu. Add the following menus: <pre class="fixed_text">  Indent       Caption         Name

none        "&File"         "FileMenu" 1           "&Test"         "FileMenuTest"

</li>  Add the following code to Form1: Option Explicit

Private Sub Form_Load PopupMenuCtl1.newMenu FileMenu End Sub

</li> In the Visual Basic IDE, press the F5 key to bring up Form1.</li> Right-click in the area occupied by the ActiveX control.</li></ol>

Additional query words: KBCONTROL KBCTRLCREATE kbIDE kbVBp kbdsd kbDSupport kbVBp500bug kbVBp600bug

Keywords: kbbug KB171209

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.