|
I want to pass in 2 data to enter, and add the results after adding
For example, I pass in 1 and 2 and add 3, I want to get the result of 3.
But I never get the answer, I hope I can get help
....
interface Ifun: IDispatch
{
[id (1), helpstring ("method add1")] HRESULT add1 ([in] int n1, [in] int n2, [out, retval] BSTR * ch);
};
.... // This is the interface
STDMETHODIMP Cfun :: add1 (int n1, int n2, BSTR * ch)
{
// TODO: Add your implementation code here
char * ch1 = _com_util :: ConvertBSTRToString (* ch);
int n3;
n3 = n1 + n2;
ch1 = new char [100];
itoa (n3, ch1, 100);
// delete [] ch1;
return n3;
}
Calling script:
<script language = "javascript">
var myobj = new ActiveXObject ("atltest1.fun");
var i = myobj.add1 (1,2);
alert (i);
</ script>
The result is empty. I don't know if I should improve there. I hope that the passing expert can help. |
|