aryan_a
February 19th, 2004, 01:14 AM
Hi All,
I am facing the problem when I tried to call from VC++ 6.0 Application.
I done the following steps.
1) Created C# component dll with one interface and three method
a) method 1: Takes no arguments and void return type
b) method 2 takes int paramets and returns the sum of these two parameters.
c) method 3 takes string paramets and returns the sum of these two parameters.
2) Put the assembly in GAC(Global Assembly Cache) and generated TypeLibe file
3) Wrote a sample VB application, added ref, i am able to call the all the 3 methods got the correct results with out any error.
4) wrote a VC application, Added the typeLib file, called the CreateDispatch fuction ( for IDispatch interface object )
and then able to call the method 1 without any problem,
when I tried to call the method 2 or 3 I am getting error message saying that "Members not Found". When I debugged the code I came to know that "Invoke" method is failing.
Can any one help ?
The typeinfo for interface is:
[
uuid(3AD94679-793C-3644-A777-D9819C9F3B9C),
version(1.0),
dual,
custom({0F21F359-AB84-41E8-9A78-36D110E6D2F9}, "CSharpComponent2.ITest")
]
dispinterface ITest {
properties:
methods:
[id(0x60020000)]
long fnAddInt(
[in] long a,
[in] long b);
[id(0x60020001)]
BSTR fnAddString(
[in] BSTR s1,
[in] BSTR s2);
[id(0x60020002)]
void fnDoNothing();
[id(0x60020003)]
long fnJustReturn();
};
Thanks in advance
Aryan.A
I am facing the problem when I tried to call from VC++ 6.0 Application.
I done the following steps.
1) Created C# component dll with one interface and three method
a) method 1: Takes no arguments and void return type
b) method 2 takes int paramets and returns the sum of these two parameters.
c) method 3 takes string paramets and returns the sum of these two parameters.
2) Put the assembly in GAC(Global Assembly Cache) and generated TypeLibe file
3) Wrote a sample VB application, added ref, i am able to call the all the 3 methods got the correct results with out any error.
4) wrote a VC application, Added the typeLib file, called the CreateDispatch fuction ( for IDispatch interface object )
and then able to call the method 1 without any problem,
when I tried to call the method 2 or 3 I am getting error message saying that "Members not Found". When I debugged the code I came to know that "Invoke" method is failing.
Can any one help ?
The typeinfo for interface is:
[
uuid(3AD94679-793C-3644-A777-D9819C9F3B9C),
version(1.0),
dual,
custom({0F21F359-AB84-41E8-9A78-36D110E6D2F9}, "CSharpComponent2.ITest")
]
dispinterface ITest {
properties:
methods:
[id(0x60020000)]
long fnAddInt(
[in] long a,
[in] long b);
[id(0x60020001)]
BSTR fnAddString(
[in] BSTR s1,
[in] BSTR s2);
[id(0x60020002)]
void fnDoNothing();
[id(0x60020003)]
long fnJustReturn();
};
Thanks in advance
Aryan.A