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 836045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:55:08+00:00 2026-05-15T04:55:08+00:00

guys! Very important question: Please, look at my project (300Kb) . I can`t use

  • 0

guys! Very important question:

Please, look at my project (300Kb). I can`t use MFC/ATL, pure C++ only.

I have COM library (niapi.dll), but no sources/headers available, dll only.

There is class for connecting to server (NiApi::SrvrSession), class has login event handler (NiApi::SrvrSession::OnLogin).

I used

#import "NiApi.dll"

to generate wrappers/information,

then

ISrvrSessionPtr session(L"NiApi.SrvrSession");

to create object, then trying

session->put_OnLogin();

to assign events, but there is no one put_On or such member.

niapi.tlh have _ISrvrSessionEvents struct inside, but it have no relations with SrvrSession.

I need to use events from NiApi::SrvrSession for handling connection status.

Please help or my boss kill me! (sorry for broken english, I read better than speak;)

  • 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-15T04:55:09+00:00Added an answer on May 15, 2026 at 4:55 am

    COM events are handled via connection points. You need to write your own COM object that implements whichever event interface you are interested in. Then you need to connect it to the COM object that fires the events. First you QI the COM object for its IConnectionPointContainer, then find the corresponding connection point of the GUID of the event interface. The you call its Advise method to connect it to your event sink.

    class CSrvrSessionEvents: public _ISrvrSessionEvents
    {
    public:
        HRESULT OnLogin(long LoginResult)
        {
            // do something
            return S_OK;
        }
        // implement rest of _ISrvrSessionEvents
    };
    
    ISrvrSession* pSrvrSession = ...; // get ISrvrSession from somewhere
    _ISrvrSessionEvents* pSrvrSessionEvents = new CSrvrSessionEvents();
    IConnectionPointContainer* pCPC = NULL;
    pSrvrSession->QueryInterface(IID_IConnectionPointContainer, &pCPC);
    IConnectionPoint* pCP = NULL;
    pCPC->FindConnectionPoint(__uuidof(_ISrvrSessionEvents), &pCP);
    DWORD dwCookie = 0;
    pCP->Advise(pSrvrSessionEvents, &dwCookie);
    pSrvrSession->Connect(); // I assume this fires some events
    pCP->Unadvise(dwCookie);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Guys i am very new to jQuery. I have started using the auto complete
guys I know this question is very basic but I've met in few publications
I could be not more sorry guys - the question was a very wrong
All right, you guys were very helpful with my last question, so I'll try
Ok guys, this is very basic stuff I think. I'm only getting familiar with
Guys, I am very new to c++. I have just wrote this class: class
Since you guys have been very helpful in my early steps into the Play
Hi guys I have a very frustrating and strange thing happening here, when I
ok guys, this is a very good question in C code (not c++): void
Hey guys. This is a very simple question, I'm sure, but I'm getting myself

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.