Autor Tema: error 5:Invalid procedure call or argument COM dll  (Leído 5010 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Gianni

  • Bytes
  • *
  • Mensajes: 28
  • Reputación: +0/-0
    • Ver Perfil
error 5:Invalid procedure call or argument COM dll
« 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
   
Código: [Seleccionar]
    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:
Código: [Seleccionar]
Sub SetString(propertyId As BlockPropertyId, value As String)
In vb6 I use this code:
Código: [Seleccionar]
Object.SetString propertyId, "Hello"Why vb raise the error 5 ?

Thanks for Help

cobein

  • Moderador Global
  • Gigabyte
  • *****
  • Mensajes: 348
  • Reputación: +63/-0
  • Más Argentino que el morcipan
    • Ver Perfil
Re:error 5:Invalid procedure call or argument COM dll
« Respuesta #1 en: Mayo 16, 2012, 05:52:48 pm »
Have you tried compiling the IDL (with MIDL.exe) and using the resulting TLB as a reference (project->references->etc..)

Gianni

  • Bytes
  • *
  • Mensajes: 28
  • Reputación: +0/-0
    • Ver Perfil
Re:error 5:Invalid procedure call or argument COM dll
« Respuesta #2 en: Mayo 17, 2012, 05:25:09 am »
Hi
Yest I have the TLB compiled with MIDL as a reference in my project

cobein

  • Moderador Global
  • Gigabyte
  • *****
  • Mensajes: 348
  • Reputación: +63/-0
  • Más Argentino que el morcipan
    • Ver Perfil
Re:error 5:Invalid procedure call or argument COM dll
« Respuesta #3 en: Mayo 24, 2012, 02:49:07 pm »
Can you provide more details about the library so we can try to get it working?

Gianni

  • Bytes
  • *
  • Mensajes: 28
  • Reputación: +0/-0
    • Ver Perfil
Re:error 5:Invalid procedure call or argument COM dll
« Respuesta #4 en: Mayo 25, 2012, 04:36:25 am »
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:
Código: [Seleccionar]
[
    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