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. Problem with Custom COM object in implementation of Interface

Problem with Custom COM object in implementation of Interface

Scheduled Pinned Locked Moved COM
helptutorialcomquestionannouncement
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.
  • B Offline
    B Offline
    bryces
    wrote on last edited by
    #1

    Hi, I Have a custom com object which I want to use as a class member for an implemantation of another COM interface. This is what I have done and the trouble I am having: I place the COM object (my own one) as a class member in my class that Implements IExtension. (since all my other objects get a reference to the IExtension to see if it is active or not). I have created two functions which preform operations on the Custom COM object. This is where I come unstuck. I figured I had to QueryInterface to my own implementation of IExtension which has the methods defined. I don't know how to call my custom functions as I get compilation errors saying: error C2039: 'GetTargetName' : is not a member of '_NoAddRefReleaseOnCComPtr<struct IMyExtension>' Error executing cl.exe. I have no idea why this is happening and cannot work out why. If I have defined my extensions and objects as follows.... The only thing I can think of is that I am breaking one of the RULES of COM. I cannot see which one. Do I have to explicitly define the QI, AddRef, Release methods in my class? From all the example on here... I didn't think I did... here is a reference to an example: http://www.codeproject.com/com/hellocom.asp[^] your help would be greatly appreciated. cheers Bryce ///////////////////////////////////////////////////////////////////////////// // CMyExtension class ATL_NO_VTABLE CMyExtension : public CComObjectRootEx, public CComCoClass, public ISupportErrorInfo, public IMyExtension, public IExtension, public IExtensionConfig { public: CMyExtension() { //Get the below two constants from the _i.c const CLSID CLSID_TargetLayer = {0x2CEBA738,0x0533,0x4F68,{0xB1,0xC5,0x88,0xB3,0xD9,0x5B,0xA3,0xE3}}; const IID IID_ITargetLayer = {0xD149DEA4,0xBB32,0x4D9A,{0x88,0xC7,0xA2,0x61,0x43,0x7D,0xC8,0xBA}}; //create the com HRESULT hr = CoCreateInstance(CLSID_TargetLayer, NULL, CLSCTX_INPROC_SERVER,IID_ITargetLayer, (LPVOID*) &m_ipTargetLayer); if (SUCCEEDED(hr)) { } } DECLARE_REGISTRY_RESOURCEID(IDR_MYEXTENSION) DECLARE_PROTECT_FINAL_CONSTRUCT() BEGIN_COM_MAP(CMyExtension) COM_INTERFACE_ENTRY(IHistoryExtension)

    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