Default argument for DISP_FUNCTION_ID
-
I have a existing function to communicate between Java and c++Activex I am using DISP_FUNCTION_ID. I need to add a default argument to the function so that I can call it from Java script. Is is possible to do so ? Not sure how to add a default argument in the function which is accessed by using DISP_FUNCTION_ID. Need some assitance. Thanks in advance.
-
I have a existing function to communicate between Java and c++Activex I am using DISP_FUNCTION_ID. I need to add a default argument to the function so that I can call it from Java script. Is is possible to do so ? Not sure how to add a default argument in the function which is accessed by using DISP_FUNCTION_ID. Need some assitance. Thanks in advance.
Well, I Know very little about Java, and this is an MFC/CPP Forum. In CPP a default argument is declared in the function declaration in a class, as in
class CMyClass{ int MyFunct(int Arg=0);};
This is a Declaration that MyClass has a Method named'MyFunct', which returns an int, and Optionally takes a Parameter (Arg), and, that when I call this function without a parameter, that 0 will be assumed. You make those declarations in a 'Header File' You Implement the function in the Implementation File,(Typically a CPP File) were you actually Implement the function:
int MyClass::MyFunct(int Arg)
if(Arg==0)return 1;
else return 2;
}The above means that when using the class, you write:
MyClass myclass;// Instantiate the class.
myclass.MyFunct();//Will return 1, an Argument 0 is assumed
myclass.MyFunct(0);// will return 1, the Argument 0 is specified
myclass.MyFunct(12);//returns 2, as per Calculation, Arg !-0Your Marshalling Software beteween Java and CPP should give more details. :)
Bram van Kampen