|
-
May 3rd, 2007, 01:25 PM
#1
Marshal.GetIDispatchForObject
Does anyone know if it is possible to create an IDispatch pointer out of a C# class to pass to a C++ object expecting an IDispatch pointer? I assume I have to create an interface, but how do I pass that interface as a pointer?
Code:
// C++ Executable expecting a COM IDispatch pointer
CCOW.ContextManager cm = new CCOW.ContextManager()
// C# dll
ContextParticipant .ContextParticipant icp = new ContextParticipant .ContextParticipant();
IntPtr iDispatchPtr = Marshal.GetIDispatchForObject(icp);
cm.JoinCommonContext(iDispatchPtr);
When I execute the above code the iDispatchPtr contains a value when running in debug, but when I try to use it in the C++ control it becomes NULL.
Any thoughts?
Thanks in advance!
-
May 7th, 2007, 09:07 AM
#2
Re: Marshal.GetIDispatchForObject
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|