Fog Creek Software
Discussion Board

vbscript event handling question

Hi All,
I have a question regarding vbscript handling of events.

I have an ActiveX, that fires an event when a button is clicked.
The event is passed with a reference to the ActiveX properties, and when I catch this event, I want to change this property....

Using VB, I can do this, but with VBScript in Internet Explorer, I can't seem to be able to make it work.

Hence my question:

Are event parameters passed byval in vbscript ?

Thursday, June 24, 2004

I'm not sure that I understand the question.

There are two uses of "byref" in VBScript -- on the one hand, there are reference types: when you have two variables that both contain the "same" object, they each contain a reference to the object.  On the other hand, you can pass an argument "byref" which means that a reference to the variable containing the argument is passed. 

I've written some articles on the difference between the two -- see the "VBScript" archive in my blog.

But either way, event parameters are passed in VBScript however the source passes them and the sink receives them.  If you pass a VT_BYREF in the source, you'll get a VT_BYREF in the sink.  If you pass a VT_DISPATCH in the source, you'll get a ref to an object in the sink. 

Give me more details and send mail if you're having difficulty figuring it out.  However, note that I'm on vacation for the next two weeks, so I won't get to your question until sometime in late July.

Eric Lippert
Thursday, June 24, 2004

Hi Eric,
thanks for your assistance, I just fired you an e-mail with the code, hope it catches you before you leave.

If other people are interested, I can post it (and hopefully the solution) here

Friday, June 25, 2004

*  Recent Topics

*  Fog Creek Home