Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. COM Containment

COM Containment

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestioncomsysadminwindows-admin
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tim Wallace
    wrote on last edited by
    #1

    I have a work assignment wherein I have to create a COM object to contain another COM object. The inner object was not aggregatable or poolable on Win2K server, so we needed to wrap it. I'm to the point where I need to pass the function calls to the contained object. My problem is that I can't get an interface pointer to the inner objects custom interface. How would I go about this? I tried creating an IID using the value the inner object registered in the registry, but I keep getting compiler errors when I try that. How can I create a variable of the type of the inner object's custom interface since I don't have any source/headers for this object (I do have the IDL and the DLL, of course, but that's it). Time is of the essence here! I'm stuck! Thanks in advance.

    B 1 Reply Last reply
    0
    • T Tim Wallace

      I have a work assignment wherein I have to create a COM object to contain another COM object. The inner object was not aggregatable or poolable on Win2K server, so we needed to wrap it. I'm to the point where I need to pass the function calls to the contained object. My problem is that I can't get an interface pointer to the inner objects custom interface. How would I go about this? I tried creating an IID using the value the inner object registered in the registry, but I keep getting compiler errors when I try that. How can I create a variable of the type of the inner object's custom interface since I don't have any source/headers for this object (I do have the IDL and the DLL, of course, but that's it). Time is of the essence here! I'm stuck! Thanks in advance.

      B Offline
      B Offline
      Bill Wilson
      wrote on last edited by
      #2

      import the .dll and use the CreateInstance method. Say the interface is named X.A

      #import X.dll no_namespace
      IAPtr ppA;

      try {
      
      	CoInitialize(NULL);
      
      	ppA.CreateInstance(\_\_uuidof(A));
      
                  ppA->Somemethod();
      
      
      	ppCrypt->Release();
      
      	CoUninitialize();
      

      Thanks for the help, Bill

      B 1 Reply Last reply
      0
      • B Bill Wilson

        import the .dll and use the CreateInstance method. Say the interface is named X.A

        #import X.dll no_namespace
        IAPtr ppA;

        try {
        
        	CoInitialize(NULL);
        
        	ppA.CreateInstance(\_\_uuidof(A));
        
                    ppA->Somemethod();
        
        
        	ppCrypt->Release();
        
        	CoUninitialize();
        

        Thanks for the help, Bill

        B Offline
        B Offline
        Bill Wilson
        wrote on last edited by
        #3

        The line ppCrypt->Release(); should read ppA->Release(); Thanks for the help, Bill

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups