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. COM
  4. CComContainedObject Question

CComContainedObject Question

Scheduled Pinned Locked Moved COM
helpc++databasecomdebugging
1 Posts 1 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.
  • C Offline
    C Offline
    Craig Longman
    wrote on last edited by
    #1

    I have a plugin that I'm developing that is used in a COM environment. The issue is, I seem to be able to readily obtain an pointer to a base class of my class, but I'm unable to figure out how to get a pointer to my main class. Here is my class:

    class ATL_NO_VTABLE Plugin :
    public CDXBaseNTo1,
    public CComCoClass< Plugin, &CLSID_Plugin >,
    public IDispatchImpl< IPlugin, &IID_IPlugin, &LIBID_MAINLib >,
    #if(_ATL_VER < 0x0300)
    public CComPropertySupport< Plugin >,
    #endif
    public IObjectSafetyImpl2< Plugin >,
    public IPersistStorageImpl< Plugin >,
    public ISpecifyPropertyPagesImpl< Plugin >,
    public IPersistPropertyBagImpl< Plugin >,
    public CSFVideoPlugin< PLUGINPROPS >

    The CSFVideoPlugin is derived from the ISfExchangeProps< PLUGINPROPS > interface. Then, in another are of the plugin environment, the Property Page to configure it, I can do the following:

    CComQIPtr< ISfExchangeProps< PLUGINPROPS >, &IID\_ISfExchangeProps >
      pxPlugin( m\_ppUnk\[ 0 \] );
    

    This part all works fine, and calls into the pxPlugin work fine. When inside a method call there, the debugger shows [ATL::CComContainedObject<Plugin>] as the first "member" of this, so the relationship is known, or so it would seem. But calls like this return a completely bogus pointer:

    CComQIPtr< Plugin, &IID\_IPlugin >
      pxPlugin( m\_ppUnk\[ 0 \] );
    

    The memory is in the same basic area, but the values are all messed up, and in fact setting them on occasion can/will crashes. I can't figure out how to query for that CComContainedObject interface. Given that even the debugger has enough information to track it down though, clearly it must be. Any help would be greatly appreciated. If I haven't provided a piece of information that would be useful, please let me know. Thanks, CraigL

    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