COM interop problem

D

DeepDiver

Hey,

i have problems with the COM interop stuff of .NET.
I have a COM component with following interface:

interface IActionSet
{
void foo();
}
interface IController
{
void Init( IActionSet* as );
}

i added this dll to my .NET project, implemented a C# class which implements
IActionSet.
then i pass this class to the method Init(...).
inside i just call foo()

what i get as result is a NullReferenceException.

Anybody any idea how to solve this?

THX

Tom
 
A

Arthur Nesterovsky

Hi,
i added this dll to my .NET project, implemented a C# class which implements
IActionSet.
then i pass this class to the method Init(...).
inside i just call foo()

what i get as result is a NullReferenceException.

Can you send whole code, including Init() method?
______________________________
With best wishes, Arthur Nesterovsky
Please visit my home page:
http://www.nesterovsky-bros.com
 
D

DeepDiver

C# file:

....

[ClassInterface(ClassInterfaceType.AutoDispatch)]

class ActionSetImpl : ATLControllerLib.IActionSet

{

public void Bla(){}

}

[STAThread]

static void Main()

{

ATLControllerLib.IControllerClass cc = new
ATLControllerLib.IControllerClass();

ActionSetImpl AS = new ActionSetImpl();

AS.Buy();

ATLControllerLib.IEventHandler eh = cc.Init( AS );

return;

}

Implementation of COM methode: (created with .NET studio -> add simple ALT
object)

STDMETHODIMP CIController::InitController(IIActionSet* as, IIEventHandler**
ret)

{

as->Bla();

return S_OK;

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top