COM interface OK in VB6 but fails with type mismatch in VBScript 
Author Message
 COM interface OK in VB6 but fails with type mismatch in VBScript

I have a dual COM interface defined as follows:

import "ocidl.idl";
 [
     object,
     uuid(624B7AA2-ECC6-4EC7-98CC-3762EB42EF55),
     dual,
     helpstring("Iimdsi Interface"),
     pointer_default(unique)
 ]
     interface Iimdsi : IDispatch
     {
          [id(1), helpstring("method PANDA")] HRESULT PANDA([in] BSTR
sRequest, [out] BSTR *sResponse);
     };

This works fine in VB when:

    DIM sRequest as String
    DIM sResonse as String
    ...
    rc = objDSI.PANDA(sRequest,sResponse)

But fails with a type mismatch when defined as Variant's in VBScript (the
only option available):

    DIM sRequest
    DIM sResponse
    ...
    rc=objDSI.PANA(sRequest,sResponse)

The problem is likely related to IDispatch automation, but I am at a loss as
to what to do about it.

Any suggestions?



Tue, 08 Jan 2002 03:00:00 GMT  
 COM interface OK in VB6 but fails with type mismatch in VBScript


<a VB question>

Quote:
> Any suggestions?

You could ask in a VB group.

--
Dan Evens
Standard disclaimers etc. No spam please.



Tue, 08 Jan 2002 03:00:00 GMT  
 COM interface OK in VB6 but fails with type mismatch in VBScript
Dan,

Good suggestion.

The COM object is written in C++, and COM is supposedly language-neutral, so
I was hoping someone in here might have an inkling.

-- Bill


Quote:


> <a VB question>
> > Any suggestions?

> You could ask in a VB group.

> --
> Dan Evens
> Standard disclaimers etc. No spam please.



Tue, 08 Jan 2002 03:00:00 GMT  
 COM interface OK in VB6 but fails with type mismatch in VBScript
This sort of question belongs more in
microsoft.public.vb.ole.automation ,
so I've set followups to go there.

Quote:

> I have a dual COM interface defined as follows:

> import "ocidl.idl";
>  [
>      object,
>      uuid(624B7AA2-ECC6-4EC7-98CC-3762EB42EF55),
>      dual,
>      helpstring("Iimdsi Interface"),
>      pointer_default(unique)
>  ]
>      interface Iimdsi : IDispatch
>      {
>           [id(1), helpstring("method PANDA")] HRESULT PANDA([in] BSTR
> sRequest, [out] BSTR *sResponse);
>      };

The above method has the signature of
a VB subroutine.  If it was a function, the
last parameter would have a 'retval' attribute.

Quote:
> This works fine in VB when:

>     DIM sRequest as String
>     DIM sResonse as String
>     ...
>     rc = objDSI.PANDA(sRequest,sResponse)

I would expect that to not work.
Certainly the HRESULT is not
available as a return value in VB.

Quote:
> But fails with a type mismatch when defined as Variant's in VBScript (the
> only option available):

>     DIM sRequest
>     DIM sResponse
>     ...
>     rc=objDSI.PANA(sRequest,sResponse)

If fails because the call was formulated
as requiring a return value but the last
parameter is not marked as providing one.

Quote:
> The problem is likely related to IDispatch automation, but I am at a loss as
> to what to do about it.

> Any suggestions?

Add ",retval" just after the "out".

--
Larry Brasfield
Above opinions may be mine alone.



Tue, 08 Jan 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. COM error: eVB calling eVC object give type mismatch

2. Debug version of ATL COM DLL fails to register, MinDependency OK

3. interface inheritance failing while referring the COM dll in .NET project

4. Problem returning VARIANT type from a COM Interface

5. Type Mismatch in Structure Reference

6. Type Mismatch in Structure Reference

7. getchar()"type mismatch"

8. LINT complains integer types mismatch

9. type mismatch

10. : Type mismatch?

11. checking for type name mismatch

12. type mismatch question - Thanks for last answer!

 

 
Powered by phpBB® Forum Software