Re: Invalid callback object instance



Aaron,

This all works great so long as the application is written in C++. I'm
having a problem with a sample app I wrote in C#, however. The object
I receive as the first parameter (caller) is not valid. The debugger
shows that it has the correct type, but if you try to access it you
wind up with invalid cast exceptions.

Did you import a type library that defines teh ICallback interface, or
did you write yoru own definition of it in managed code?

Does the callback happen on the same thread or a different one?

Do you have the source code for the COM library?


Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
.



Relevant Pages

  • Re: Windows Native Calls
    ... A call to a native (i.e. not managed code) function provided by for ... Mattias Sjögren [C# MVP] mattias @ mvps.org ... Please reply only to the newsgroup. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Pointers to Functions in C#
    ... For some reason I didn't even think about it. ... managed code. ... By using Win32 API GetModuleHandle() and FreeLibraryI was ... "Mattias Sjögren" wrote: ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Accessing enumerators in C# DLL from VB6
    ... underscore) enums are exported from managed code. ... Mattias Sjögren mattias @ mvps.org ...
    (microsoft.public.dotnet.framework.interop)
  • Re: convert idl to c# or tlb
    ... trying to create a mime filter for ie in c# (actually in vb.net but the ... I wouldn't recommend doing that in managed code. ... Mattias Sjögren mattias @ mvps.org ...
    (microsoft.public.dotnet.languages.vb)

Loading