Visual Basic Foro
Programación => Visual Basic 6 => Mensaje iniciado por: Gianni en Mayo 16, 2012, 03:28:23 pm
-
Hi to all
I have a problem with a third-party com dll.
I have the IDL description of this dll.
I 'm trying to modify this IDL for use dll from vb6.
I have to Get/Set value:
there is no problem to get the values from the dll , but when
I try to set the values , vb raise the error 5:Invalid procedure call or argument (for any datatype)
This is the IDL description: BlockPropertyId are constant
HRESULT SetFlag([in] BlockPropertyId propertyId, [in] BOOL value);
HRESULT GetFlag([in] BlockPropertyId propertyId, [out] BOOL* value);
HRESULT SetInt([in] BlockPropertyId propertyId, [in] LONG value);
HRESULT GetInt([in] BlockPropertyId propertyId, [out] LONG* value);
HRESULT SetFloat([in] BlockPropertyId propertyId, [in] double value);
HRESULT GetFloat([in] BlockPropertyId propertyId, [out] double* value);
HRESULT SetString([in] BlockPropertyId propertyId, [in] BSTR value);
HRESULT GetString([in] BlockPropertyId propertyId, [out] BSTR* value);
Someone have any idea about this error ?
I see in the object browser:
Sub SetString(propertyId As BlockPropertyId, value As String)
In vb6 I use this code:
Object.SetString propertyId, "Hello"Why vb raise the error 5 ?
Thanks for Help
-
Have you tried compiling the IDL (with MIDL.exe) and using the resulting TLB as a reference (project->references->etc..)
-
Hi
Yest I have the TLB compiled with MIDL as a reference in my project
-
Can you provide more details about the library so we can try to get it working?
-
HI
I have resolved this problem.
The problems was the LONGLONG datatype.I have changed to CURRENCY in TypeLib.
Now I can SetInt.Problems remains with String datatype,but it is not very important.
Now I need to use a callback function.
I have this Idl definition:
[
object,
uuid(1E8701D0-258F-43ED-9EDC-434FD16E922D),
helpstring("Switcher Object")
] interface IBMDSwitcher : IUnknown
{
HRESULT AddCallback([in] IBMDSwitcherCallback* callback);
HRESULT RemoveCallback([in] IBMDSwitcherCallback* callback);
..others properties
};
[
object,
uuid(6C6E4441-9421-4729-9951-988659E3A44A),
helpstring("Switcher Callback Delegate")
] interface IBMDSwitcherCallback : IUnknown
{
HRESULT PropertyChanged([in] BMDSwitcherPropertyId propertyId);
HRESULT Disconnected(void);
};
I need to get the Disconnected Event.
How I can Implement this Callback?
Thanks for Help
-
You can implement interfaces in vb6 with clases. Check the links
http://www.shomsky.com/Technical/Articles/ImplementingInterfacesInVB6.asp
http://stackoverflow.com/questions/4381972/interface-limitations-in-vb6
http://leandroascierto.com/foro/index.php?topic=993.0
http://www.vb-helper.com/howto_interface_inheritance.html