Creating an instance of a class with a parameterized constructor from COM

Is it possible to call a parameterized constructor with COM? I am going to create an instance of a C # class that has a parameterized constructor with COM. Now he picks up Memory Excpetion. so I'm not sure about instantiating a C # class that carries a parameterized constructor with COM. So please tell me about it.

My c # constructor

public GetNumberFromClass(NumberClass number)
{
}

Constructor C ++:

NumberFromC#::NumberFromC#
{
    getNumberFromClassPtr.CreateInstance(__uuidof(GetNumberFromClass));
}

and the getNumberFromClassPtr pointer throws a memory exception because it is typing NULL.

+4
source share
1 answer

, COM . ++, GUID __uuidof , NumberClass. .

: CreateInstance() HRESULT. , . - NULL, , .

, #, , COM. NumberClass, . , , ++, , . CreateInstance(), try/catch , , _com_error, .

+2

All Articles