Pass Nothig value to Com component

Posted on 2006-07-03
Medium Priority
Last Modified: 2013-11-25
I've builded a Net-Com Interop Library, wich I need to invoke from C++.
The library works sucessfully, but I need to pass COM VB Nothing in some arguments means the are not value for the argument.
Can any help me?
Question by:elbahari
LVL 18

Expert Comment

by:Jose Parrot
ID: 17030664

Assuming the DLL can manage the absence of an explicit parameter, the call is made with NULL.
    MyFunction(param1, param2, NULL, param4, NULL);
    MyFunction(param1, param2, , param4,);

LVL 25

Expert Comment

ID: 17035177
See the following article:


Optional parameters are specified as:

      // VARIANT used in place of optional-parameters.
      VARIANT varOpt;
      varOpt.vt = VT_ERROR;
      varOpt.scode = DISP_E_PARAMNOTFOUND;

Author Comment

ID: 17036626
I´ve increased the  value.....

I´ve an external library thant receive an string in C++, from an external source.
This string contains an integer value if the value change, or spaces if they are not changes.
I use c++ to retrieve the value, and I´ve builted a COM component in order to send the value to an NET app, receiving an integer value to the parameret. To do, I convert the string to an in

char NumericText[7]={"\0"};

I want to send the numeric value if the string content has not spaces, or  "Nothing" if the string contains spaces.

Obviously, the solution is not call or not  or not the FunctionCom, because real FunctionCom has many others parameters and values wich I need to send.

Thanks a lot




Accepted Solution

Dariusz Dziara earned 1500 total points
ID: 17042154
Maybe change (this is alternative)


so you will pass pointer instead of value like:

FunctionCom([in] long *pVal)

then you can call


to indicate NO VALUE

or add extra parameter

FunctionCom([in] long Val, [in] BOOL Empty)

to indicate such case


Author Comment

ID: 17063974
Ok, Thanks a lot, Mr Blue, both works sucessfully.

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

586 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question