Solved

ActiveX Control Events ByRef Parm doesn't return in VBScript

Posted on 1998-12-01
3
452 Views
Last Modified: 2012-08-13
I have a ActiveX Control written in VC that fires a MyContextMenu event:
ContextMenu(VARIANT pIContextMenu, short x, short y, long dwReserved, boolean* bHandled);
The problem is with the last parameter bHandled.  If this returns TRUE it doesn't display my context menu.  The problem is that from VB Script this parameter value doesn't get set to the value in the following VB Script code:
Sub MyComponent_MyContextMenu(ByVal pIContextMenu, ByVal x, ByVal y, ByVal dwReserved, ByRef bHandled)
    bHandled = True
End Sub

This same code in VB works fine.
Any ideas?
0
Comment
Question by:skin
  • 2
3 Comments
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1447705
Note that a boolean in C++ uses values 1 and 0. While in VB it uses -1 and 0.
0
 
LVL 13

Accepted Solution

by:
Mirkwood earned 100 total points
ID: 1447706
Note that a boolean in C++ uses values 1 and 0. While in VB it uses -1 and 0.
0
 

Author Comment

by:skin
ID: 2242144
My experience is that ByRef only works for variants in VB Script
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now