callavin
June 12th, 2006, 05:55 AM
I made one com application in C#(2005)
namespace com_server
{
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface _Class1
{
[DispId(1)]
int adingg(int a, int b);
}
[ClassInterface(ClassInterfaceType.None)]
public class Class1 : _Class1
{
public Class1() { }
public int adingg(int a, int b)
{
return ((a+b));
}
}
}
In the properties of this solution I choose "Make it a COM application", which i think generates the GUID stuff to the code.
I registered it.
Then In VC++ MFC application I imported the corresponding tlb file.
And added these lines in the cpp file.
com_server ::_Class1Ptr ptr(__uuidof(com_server ::_Class1 ));
int num = ptr->adingg(12,14);
The VC++ application build fine but it is giving unhabdled exception. guideme where I am wrong
Plz tell me some good tutorial on this stuff also..
-----------
thanks
namespace com_server
{
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface _Class1
{
[DispId(1)]
int adingg(int a, int b);
}
[ClassInterface(ClassInterfaceType.None)]
public class Class1 : _Class1
{
public Class1() { }
public int adingg(int a, int b)
{
return ((a+b));
}
}
}
In the properties of this solution I choose "Make it a COM application", which i think generates the GUID stuff to the code.
I registered it.
Then In VC++ MFC application I imported the corresponding tlb file.
And added these lines in the cpp file.
com_server ::_Class1Ptr ptr(__uuidof(com_server ::_Class1 ));
int num = ptr->adingg(12,14);
The VC++ application build fine but it is giving unhabdled exception. guideme where I am wrong
Plz tell me some good tutorial on this stuff also..
-----------
thanks