COM interop problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • DeepDiver

    #1

    COM interop problem

    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 NullReferenceEx ception.

    Anybody any idea how to solve this?

    THX

    Tom


  • Arthur Nesterovsky

    #2
    Re: COM interop problem

    Hi,
    [color=blue]
    > i added this dll to my .NET project, implemented a C# class which[/color]
    implements[color=blue]
    > IActionSet.
    > then i pass this class to the method Init(...).
    > inside i just call foo()
    >
    > what i get as result is a NullReferenceEx ception.[/color]

    Can you send whole code, including Init() method?
    _______________ _______________
    With best wishes, Arthur Nesterovsky
    Please visit my home page:




    Comment

    • DeepDiver

      #3
      Re: COM interop problem

      C# file:

      ....

      [ClassInterface( ClassInterfaceT ype.AutoDispatc h)]

      class ActionSetImpl : ATLControllerLi b.IActionSet

      {

      public void Bla(){}

      }

      [STAThread]

      static void Main()

      {

      ATLControllerLi b.IControllerCl ass cc = new
      ATLControllerLi b.IControllerCl ass();

      ActionSetImpl AS = new ActionSetImpl() ;

      AS.Buy();

      ATLControllerLi b.IEventHandler eh = cc.Init( AS );

      return;

      }

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

      STDMETHODIMP CIController::I nitController(I IActionSet* as, IIEventHandler* *
      ret)

      {

      as->Bla();

      return S_OK;

      }



      "Arthur Nesterovsky" <arthur@nestero vsky-bros.com> wrote in message
      news:etqw6$EeDH A.1836@TK2MSFTN GP09.phx.gbl...
      [color=blue]
      > Hi,
      >[color=green]
      > > i added this dll to my .NET project, implemented a C# class which[/color]
      > implements[color=green]
      > > IActionSet.
      > > then i pass this class to the method Init(...).
      > > inside i just call foo()
      > >
      > > what i get as result is a NullReferenceEx ception.[/color]
      >
      > Can you send whole code, including Init() method?
      > _______________ _______________
      > With best wishes, Arthur Nesterovsky
      > Please visit my home page:
      > http://www.nesterovsky-bros.com
      >
      >
      >[/color]


      Comment

      Working...