Showing results for 
Search instead for 
Did you mean: 

Error -2147352562 (0x8002000E, DISP_E_BADPARAMCOUNT) on COM component


Error -2147352562 (0x8002000E, DISP_E_BADPARAMCOUNT) on COM component

Hi there,

we have a self-written COM object and are trying to fix an error which occures when implementing this object into LabVIEW.


The COM object is written in Visual Studio 2017 (compiler version 15), compiled as EXE and successfully registered (using /REGSERVER switch).


Inside this COM object there are some test functions (The regular object is much bigger, we shrinked it as much as possible to focus on the error):


__interfaceIKalibOle: IDispatch
  [id(1), helpstring(P_EX"return true")]
  HRESULTCER_True([out, retval] VARIANT_BOOL* pbErg);

  [id(2), helpstring(P_EX"return false")]

  [id(3), helpstring(P_EX"add two long")]
  HRESULTCER_Add([in] LONGSumA, [in] LONGSumB, [out] LONG*Res, [out, retval] VARIANT_BOOL* pbErg);

  [id(4), helpstring(P_EX"sub two long, no retval")]
  HRESULTCER_Sub_NR([in] LONGSumA, [in] LONGSumB, [out] LONG*Res, [out] VARIANT_BOOL* pbErg);

  [id(5), helpstring(P_EX"mult two double")]
  HRESULTCER_Mult([in] doubleFacA, [in] doubleFacB, [out] double*Res, [out, retval] VARIANT_BOOL* pbErg);

  [id(6), helpstring(P_EX"div two double, no retval")]
  HRESULTCER_Div_NR([in] doubleFacA, [in] doubleFacB, [out] double*Res, [out] VARIANT_BOOL* pbErg);

You see two types of functions: one with return value ([out, retval] for the last parameter, this should be the normal case) and one without (only [out], only for testing). These functions are part of the "KalibOle" object, so this object has to be created first. A small snippet in LabVIEW which calls two test functions (one with return value, one without) looks then like this:


VI snippetVI snippet

Whereas the function without return value (CER_Sub_NR in this case) runs without any problems, the function with return value (CER_Add) returns with error -2147352562 (0x8002000E) in <error out>. This is the COM error code DISP_E_BADPARAMCOUNT (listed here: and means that the number of parameters is insufficient ("Unzulässige Parameteranzahl" in german).





We crawled the whole forum for hints and tricks, but it seems that

a.) LabVIEW is able to handle COM components automatically

b.) the usage of a return value is regular practice


Of course we have the suspicion that something goes wrong with the parameter handling, but we have no idea why the function with a return value fails whereas the function without a return value succeeds.


Note: VARIANT BOOL is defined as:

typedef short VARIANT_BOOL;


Any suggestions?


Regards from Berlin/Germany




0 Kudos
Message 1 of 1