AnsweredAssumed Answered

vrf mapping scales

Question asked by cjimenez on Sep 23, 2003
Hi Shawn,
         I had a feeling this may be in your territory!  Many thanks for
taking the time to reply, unfortunately I think this may indicate one of
two things - either I have totally missed something or there is something
fundamental stopping me.  It may be useful if I could see more than just a
"type mismatch at argument index 1" ( would have thought that, like
everything else in VEE, it should have been index 0, but maybe that's a
clue as to the source of the error message ).

I have tried your suggestions with no difference, also setting up a
VBScript to create an array and invoke the method ( this last idea was done
in two ways - 1. use a VB script to return a variant array and use the
array for a VEE call and 2. include the call within the script as
DOObj.StartContDO(Buffer) where Buffer was (a) passed in and (b) assigned
to a locally declared var ( always variant in VBScript ) - 1. gave same
error message, 2. just saying there was an error in the 'Run' method with
the "ActiveX object returned error message: Type Mismatch
'DOObj.StartContDO'" - note this message is slightly different from that
reported from the VEE call )

I have also tried setting up a global as either a variant ( and setting it
to an Int16 array ) or as a Variant array  and then assigning the variant
array to the Int16 array, with no change of message.  The error number I am
seeing is 552 which may be a small clue:
"552  <name> in the referenced ActiveX object failed" which would lead me
to think that (a) VEE made the call (b) the ActiveX control returned the
mismatch error and (c) VEE reported the error with the message from the
control... i.e. I would think that it was the control that is "throwing the
type mismatch" ( I'll try not to catch any other Java terminology ).

Any other suggestions, or even off-the-wall comments welcome.

Best Regards,

Mike Watts

P.S. it is nearly 1 a.m. here now - must ...stop....for... the ... night...

Previous messages:
A few quick thoughts:

> 3. one particular method ( sending a digital output stream ) keeps
> returning a type mismatch error - I have tried all sorts of types
> including int16 ( which is what I would expect ) and forcing using
> asVariant()

The critical thing is exactly who is throwing a type mismatch. If it's VEE,
it's one thing. If it's the control, it's another.

There's a subtle ambiguity about using Variant in the context of an ActiveX
call (i.e., IDispatch call): everything is always passed as Variant,
regardless of what the type library looks like it's saying. When the actual
type being passed *is* variant (i.e., (var.vt && VT_TYPEMASK) && VT_VARIANT
== TRUE as it should be here) then both the client and the server must
realize that one level of resolution has been lost. IOW, if the value being
passed by an IDispatch interface is Variant, then that Variant must
ultimately specify what type it represents. It cannot represent Variant -
that's an abstract type that has no representation.

To further complicate the issue, there's ByRef. Variants are *always*
by reference anyway, much like strings. Adding ByRef implies that the
Variant passed through the IDispatch interface is a pointer to another
Variant (or array of Variants) who's vt member will presumably specify what
type the Variant is.

The manufacturer's declaration:

> boolean StartContDO(VARIANT* Buffer)

gives more hint for what it isn't than what it is. StartContDO - Start /
Continue Digital Output? Buffer? A buffer is usually a large chunk of
memory, but it doesn't have to be. "( sending a digital output stream )" -
this also seems to imply many values.

I'd say that this function expects an array of Variants of type int8, int16
or int32 that are to be clocked out by some previously set time base. Try
bSuccess = StartContDO(asVariant([value, value, etc...]); and see if that
gets you anywhere.

You know Mike, come to think of it VEE would probably build that into a
safearray. Try bSuccess = StartContDO([asVariant(value), asVariant(value),

(isn't this FUN??

   I know there have been discussions on this forum before regarding
ActiveX and variants - maybe I missed the particular point but here is my

1. a manufacturer has provided an ActiveX [Control] interface to a data acq

2. some methods work very nicely

3. one particular method ( sending a digital output stream ) keeps
returning a type mismatch error - I have tried all sorts of types including
int16 ( which is what I would expect ) and forcing using asVariant()

4. the prototype that is provided by VEE's function & object browser is:

<objectname>.StartContDO(ByRef Buffer)

5. I contacted the manufacturer who did some investigation ( to their
credit ) and pointed out a part of the VEE documentation that says "variant
type of VEE only supports call by reference".

6. the manufacturer also provided the declaration for the method:

boolean StartContDO(VARIANT* Buffer)

which, to me, looks like a pointer i.e. a reference to the variable.

I suspect that I may be able to use some technique like the VB script
control as a wrapper ( I will try this anyway ).

Any bright ideas?

Regards to all,

Mike Watts

You are currently subscribed to vrf as:
To subscribe send a blank email to "".
To unsubscribe send a blank email to "".
To send messages to this mailing list,  email "". 
If you need help with the mailing list send a message to "".