Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / July 2005

Tip: Looking for answers? Try searching our database.

How to implement COM callbacks in managed C++?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
anders - 19 Jul 2005 12:54 GMT
I call from managed C++ a DCOM server interface method that takes a callback
interface as parameter. I cannot figure out how to implement such a callback
object in managed C++. The callback interface (e.gr. ICallback) is defined by
the server type library.

I have figured out that the following code seems to implement a COM object
in managed C++ but how do I implement the callback interface ICallback:

#import "dcom_server.exe" // Import server type library
using namespace System::Runtime::InteropServices;

[GuidAttribute("..."), ClassInterface(ClassInterfaceType::AutoDual)]
public __gc class CallbackImplementation
{
};

I cannot inherit from the ICallback interface because it's unmanaged code.

Any ideas?

Anders
Jochen Kalmbach [MVP] - 19 Jul 2005 15:52 GMT
Hi anders!
> I call from managed C++ a DCOM server interface method that takes a callback
> interface as parameter. I cannot figure out how to implement such a callback
> object in managed C++. The callback interface (e.gr. ICallback) is defined by
> the server type library.

If your server uses late-bindung you can implement the callback like:

<code>
  [ComVisible(true)]
  [ClassInterface(ClassInterfaceType.AutoDispatch)]
  public class MyCallback
  {
    [DispId(1)]
    public void OnXxx(int eventHandle, object data, int result)
    {
    }
  }
</code>

Currently I do not know how to do it if you must provide a early-binding...

Signature

Greetings
  Jochen

   My blog about Win32 and .NET
   http://blog.kalmbachnet.de/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.