This is a known problem. The error comes from the short params. VFP doesn't deal correctly with short COM params. At least this is the situation in 5.0. Maybe 6.0 fixed the problem but I haven't tested.
The only solution I know is to change the COM params to long. If it's a third party COM, call them and explain them your problem. Maybe they will accept to change it. BTW, there's really no gain from using short params. Long will do it just the same.
Vlad
>I´m working with a DLL COM (VC++) witch has 2 methods that give me problems.
>This is the definition of that methods in the dll (VC++ code):
>
>[id(1), helpstring("method Open")] HRESULT Open(BSTR xlName, [out] short* xlHandle);
>
>[id(7), helpstring("method Get")] HRESULT Get(short xlHandle, [out] VARIANT *xlValue, long xlRow, long xlCol, [out] BSTR *xlFont, [out] double *xlSize, [out] long *xlColor);
>
>From my VFP application I’m doing this:
>
>Obj = CreateObject(“Object”)
>
>Name=”c:\file”
>Handle=0
>Obj.Open( Name, @Handle ) ß I get a type mismatch (OLE error code 0x80020005: Type mismatch) (the parameter @HAndle is a short* in the dll).
>
>Value=space(20)
>Font=space(20)
>Size=0
>Color=0
>Obj.Get( Handle, @Value, 1, 1, @Font, @Size, @Color ) ß @Value (this parameter is a Variant* in the dll). I get the same error (OLE error code 0x80020005: Type mismatch).
>ß @Size (this parameter is a double* in the dll) the same error (OLE error code 0x80020005: Type mismatch)
>
>There’s no problem with long* and BSTR*.
>Any idea about working with short*, double*, and variant* of VC++ from a VFP application?
>Thanks.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only