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

  • SEARCH
  • Home
  • 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 5842247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:59:35+00:00 2026-05-22T11:59:35+00:00

I got 2 events in my ActiveX/ATL library dispinterface _IMyEvents { properties: methods: [id(1),

  • 0

I got 2 events in my ActiveX/ATL library

dispinterface _IMyEvents
{
    properties:
    methods:
    [id(1), helpstring("method OnReceiveData")] HRESULT OnReceiveData([in] long BytesReceived, [in, out] VARIANT_BOOL * Proceed);
    [id(2), helpstring("method OnReceiveDataEx")] HRESULT OnReceiveDataEx([in] long BytesReceived, [in] BSTR DataChunk, [in, out] VARIANT_BOOL * Proceed);
 };

They are called in the standard ATL’s way:

 template <class T>
 class CProxy_IMyEvents : public IConnectionPointImpl<T, &DIID__IMyEvents, CComDynamicUnkArray>
 {
    //Warning this class may be recreated by the wizard.
 public:
    HRESULT Fire_OnReceiveData(LONG BytesReceived, VARIANT_BOOL * Proceed)
    {
        CComVariant varResult;
        T* pT = static_cast<T*>(this);
        int nConnectionIndex;
        CComVariant* pvars = new CComVariant[2];
        int nConnections = m_vec.GetSize();

        for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
        {
            pT->Lock();
            CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
            pT->Unlock();
            IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
            if (pDispatch != NULL)
            {
                VariantClear(&varResult);
                pvars[1] = BytesReceived;
                pvars[0].vt = VT_BYREF|VT_BOOL;
                pvars[0].pboolVal = Proceed;
                DISPPARAMS disp = { pvars, NULL, 2, 0 };
                pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
            }
        }
        delete[] pvars;
        return varResult.scode;
    }

I need to know if application has subscribed particularly to OnReceiveDataEx event (which has extra parameter DataChunk which needs to be calculated). If the app only listens to OnReceiveData, I don’t need to build DataChunk string as nobody will get it, and can optimize the performance.

ATL, however, only allows me to know if anybody has subscribed to any events at all, but not to which ones particularly (so I can only determine the number of objects (sinks) listening to my events, but not the number and names of particular events being listened to). Is there any way to overcome this?

In .net, for instance, you can check subscribers for an event independently of other events.

  • 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-22T11:59:35+00:00Added an answer on May 22, 2026 at 11:59 am

    If you need to make this distinction, ATL or no, you will need two interfaces. One for OnReceiveData and one for OnReceiveDataEx. A given event sink has to implement all the methods of an event interface, even if it only cares about one.

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

Sidebar

Related Questions

I got a set of events that I'm displaying in a UITableView. Each event
I got a worker thread which throws events, which are handled by common handler
I got 2 columns festivals and events, like festival id | name | modified_date
I got a query regarding adding dynamic buttons with dynamic onclick events on a
I've got a mysql table of 'events' with columns for 'category' and 'visited'. There's
Just finished reading Jon Skeet's article about events and delegates and got a question.
In Winforms we (developers) handle user interactions via events. In WPF we got commands.
I'm working on a hack to the DotNetNuke Events module. I've got the source
I've been writing an ActiveX plugin for IE using .NET. While I've happily got
I've got two events in my plugin. One is run for the front-end. 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.