How to call interface API from within COM server

Posted by Alien01 on Stack Overflow See other posts from Stack Overflow or by Alien01
Published on 2010-05-24T11:17:23Z Indexed on 2010/05/24 11:21 UTC
Read the original article Hit count: 438

Filed under:
|
|

I have one com server with some interfaces exposing some API's

COM class looks like below

class ATL_NO_VTABLE CTask :
    public CComObjectRootEx<CComSingleThreadModel>,
    public CComCoClass<CTask, &CLSID_Task>,
    public ITask
{

public:
 STDMETHOD (Task)();
 STDMETHOD (ABC)();
...
}

Now this com server also contains one more class XYZ

ABC API needs to call XYZ functionality

 STDMETHODIMP ABC()
{
    XYZ xyz;
    xyz.dosomething();
}

dosomething function need to call com server Task function, like below

  class XYZ
       {
      public:
        void dosomething()
         {
        // need to call Task function
         }
        };

How can this be done? Do I need to CoCreateInstance ITask in dosomething?

I tried creating CTask taskl; in dosomething but it gave some errors.

© Stack Overflow or respective owner

Related posts about com

Related posts about vc++