Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6951381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:12:45+00:00 2026-05-27T14:12:45+00:00

I am trying to build Connection Points in existing COM component. I derive the

  • 0

I am trying to build Connection Points in existing COM component.
I derive the class from CCmdTarget and call MFC macros in class declaration and implementation as described in MSDN. Component is correctly build, linked, and run.
However, when I debug my client application I see the following issue:

Client locates the correct component, finds the connection point container, but fails on FindConnectionPoint with E_NOINTERFACE.
I suspect that I have to add or modify some MFC macros to include my connection point into container but not sure how to do this.

So, please help me to resolve this issue or give a hint where else to look for the issue.

Thanks in advance,
Hovo


[ uuid(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx), version(1.0) ]
library SMC
{
    importlib("stdole32.tlb");
    importlib("stdole2.tlb");
    [
        uuid(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx),
        helpstring("_IAdHocPresenceEvents Interface")
    ]
    interface _IAdHocPresenceEvents : IUnknown
    {
        [id(1), helpstring("method OnAdHocPresenceQuery")] HRESULT OnAdHocPresenceQuery();
    };

    #include "ISMCLink.idl"

    [ uuid(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) ]
    coclass SMCLink
    {
        dispinterface IDispSMCLink;
        [default] interface ISMCLink;
        interface ISMCLink2;
        [default, source] interface _IAdHocPresenceEvents;
    };
};

[ 
    helpstring("Interface to control My Product"),
    uuid(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx),
    dual,
    oleautomation
]
interface ISMCLink : IDispatch
{
    //...
    /** 
    * RequestAdHocPresence
    * 
    * Sends Ad Hoc Presence Query
    *
    * @param SIP address.
    *
    * @return S_OK if the In session window was opened successfully
    */
    [id(0x00000001), helpstring("method Request for Ad Hoc Presence")]
    HRESULT RequestAdHocPresence([in] BSTR user);
};

//  Primary dispatch interface for SMC
[ uuid(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) ]
dispinterface IDispSMCLink
{
    interface ISMCLink;
};

// Definition for the new interface ISMCLink2
// ------------------------------------------

[
    helpstring("ISMCLink2, Interface to access My Product"),
    uuid(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx),
    dual,
    oleautomation
]
interface ISMCLink2 : ISMCLink
{
   //...
};

namespace MYPROD {

class SMCLink : public CCmdTarget
{
    //...

protected:

    DECLARE_MESSAGE_MAP()
    DECLARE_DISPATCH_MAP()
    DECLARE_INTERFACE_MAP()

    // Connection point for ISMCLink interface
    BEGIN_CONNECTION_PART(SMCLink, AdHocPresenceEvents)
        CONNECTION_IID(IID__IAdHocPresenceEvents)
    END_CONNECTION_PART(AdHocPresenceEvents)

    DECLARE_CONNECTION_MAP()


public:
    SMCLink(void);
    virtual ~SMCLink(void);

    // to be OLE creatable, it must be DYNCREATE and OLECREATE
    DECLARE_DYNCREATE(SMCLink)
DECLARE_OLECREATE(SMCLink)

    //..
    /** 
    * RequestAdHocPresence
    * 
    * Sends Ad Hoc Presence Query
    *
    * @param SIP address.
    *
    * @return S_OK if the In session window was opened successfully
    */
    afx_msg HRESULT RequestAdHocPresence(BSTR sipAddr);


    BEGIN_DUAL_INTERFACE_PART(DualSMCLink, ISMCLink)
        //...
    STDMETHOD(RequestAdHocPresence)(THIS_ BSTR user);
    END_DUAL_INTERFACE_PART(DualSMCLink)

};

} // namespace MYPROD

namespace MYPROD {

BEGIN_MESSAGE_MAP(SMCLink, CCmdTarget)
    //{{AFX_MSG_MAP(CAutoProxy)
    // NOTE - the ClassWizard will add and remove mapping macros here.
    //}}AFX_MSG_MAP
END_MESSAGE_MAP()

IMPLEMENT_DYNCREATE(SMCLink, CCmdTarget)


BEGIN_DISPATCH_MAP(SMCLink, CCmdTarget)
    //{{AFX_DISPATCH_MAP(SMCLink)
    //..
    DISP_FUNCTION(SMCLink, "RequestAdHocPresence", RequestAdHocPresence, VT_ERROR,     VTS_BSTR)
    //}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()


BEGIN_INTERFACE_MAP(SMCLink, CCmdTarget)
    INTERFACE_PART(SMCLink, IID_ISMCLink, DualSMCLink)
    INTERFACE_PART(SMCLink, IID_ISMCLink2, DualSMCLink)
    INTERFACE_PART(SMCLink, IID_IConnectionPointContainer, ConnPtContainer)
END_INTERFACE_MAP()

BEGIN_CONNECTION_MAP(SMCLink, CCmdTarget)
    CONNECTION_PART(SMCLink, IID_IConnectionPointContainer, AdHocPresenceEvents)
END_CONNECTION_MAP()


SMCLink::SMCLink(void)
{
    EnableAutomation();
    EnableConnections();
}

SMCLink::~SMCLink(void)
{
    //..
    if (registerCookie_ != 0)
        RevokeActiveObject(registerCookie_, NULL);
}


void SMCLink::registerActive()
{
    HRESULT hRes;
    hRes = RegisterActiveObject(GetInterface(&IID_IUnknown),
                                SMCLink::guid, NULL, &registerCookie_);
    //..
}

//..

afx_msg HRESULT SMCLink::RequestAdHocPresence(BSTR sipAddr)
{
    Sleep(1000);

    ::MessageBox(NULL, L"RequestAdHocPresence", L"RequestAdHocPresence", 0);

    Fire_AdHocPresenceStatus(); // HOWTO ???

    return S_OK;
}

STDMETHODIMP SMCLink::XDualSMCLink::RequestAdHocPresence(BSTR user)
{
    METHOD_PROLOGUE(SMCLink, DualSMCLink)

    return pThis->RequestAdHocPresence(user);
}

} // namespace MYPROD

    CLSID clientCLSID;
    if (FAILED(CLSIDFromProgID(A2BSTR("SMC.SMCLink"), &clientCLSID)))
    {
        clientCLSID = SMC::CLSID_SMCLink;
    }

    LPUNKNOWN lpUnk;
    SMC::ISMCLink* m_pSMCLink = NULL;
    if (m_pSMCLink == NULL)
    {
        if (GetActiveObject(clientCLSID, NULL, &lpUnk) == NOERROR)
        {
            hr = lpUnk->QueryInterface(SMC::IID_ISMCLink, (LPVOID*)&m_pSMCLink);
            lpUnk->Release();
        }
    }

    hr = m_pSMCLink->RequestAdHocPresence(A2BSTR("someuser@mydomain"));
    // this returns S_OK


    IConnectionPointContainer   * pConnPtContainer = NULL;
    IConnectionPoint          * pCP2 = NULL;   //these are declared as a member

    //check if this interface supports connectable objects
    hr = m_pSMCLink->QueryInterface(IID_IConnectionPointContainer,(void     **)&pConnPtContainer);
     // this returns S_OK

    IEnumConnectionPoints* pEnum = NULL;
    hr = pConnPtContainer->EnumConnectionPoints( &pEnum );
    // this returns S_OK

    hr = pConnPtContainer->FindConnectionPoint(IID__IAdHocPresenceEvents, &pCP2);
    // this returns E_NOINTERFACE

    // ..
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:12:46+00:00Added an answer on May 27, 2026 at 2:12 pm
    CONNECTION_PART(SMCLink, IID_IConnectionPointContainer, AdHocPresenceEvents)
    

    Second argument should be an IID of connection pointer interface.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to build a HQL that can left join values from a collection,
I'm trying build a method which returns the shortest path from one node to
Im trying to build call to action button on my site using jQuery. I
I am trying to build a PHP class to check the username and password
I'm currently trying to build a custom connection manager and custom data flow source
Trying to build a GUI application in Java/Swing. I'm mainly used to painting GUIs
Trying to build sslsniff on a RHEL 5.2 system here. When compiling sslsniff on
I trying to build and compile my xcodeproj in command line and it is
I'm trying to build a grammar with the following: NUMERIC: INTEGER | FLOAT |
I'm currently trying to build a personal website to create a presence on the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.