Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Pass Nothig value to Com component

Posted on 2006-07-03
5
Medium Priority
?
328 Views
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?
0
Comment
Question by:elbahari
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 18

Expert Comment

by:Jose Parrot
ID: 17030664
Hi,

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

Jose
0
 
LVL 25

Expert Comment

by:clockwatcher
ID: 17035177
See the following article:

  http://support.microsoft.com/kb/q238981/

Optional parameters are specified as:

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

Author Comment

by:elbahari
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"};
memcpy(NumericText,response->externalLibrary.thisValue,6);
NumericValue=atoi(NumericText);
FunctionCom(NumericValue);

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

 





 





0
 
LVL 8

Accepted Solution

by:
mrblue earned 1500 total points
ID: 17042154
Maybe change (this is alternative)

FunctionCom()

so you will pass pointer instead of value like:

FunctionCom([in] long *pVal)

then you can call

FunctionCom(NULL)

to indicate NO VALUE

or add extra parameter

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

to indicate such case

0
 

Author Comment

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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
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.

618 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