Used the New Add-in Wizard to create a Visual C++ / ATL add-in project.
Generated code:
HRESULT hr = S_OK;
pApplication->QueryInterface(__uuidof(DTE2), (LPVOID*)&m_pDTE);
pAddInInst->QueryInterface(__uuidof(AddIn), (LPVOID*)&m_pAddInInstance);`
Get the Events object, and the WindowEvents:
m_pDTE->get_Events(&m_pEvents);
m_pEvents->get_WindowEvents(0, &m_pWinEvents);
How to add an event handler?
if (NULL != m_pWinEvents) {
m_pWinEvents += ????
}
Thanks for any hints or references...
UPDATE, trying Alien01's suggestion:
m_pWinEvents->WindowActivated += new _dispWindowEvents_WindowActivatedEventHandler(this.WindowActivated);
1>Compiling...
1>Connect.cpp
1>c:\work\visstudio_addin\cbaddin3\cbaddin3\connect.cpp(43) : error C2039: 'WindowActivated' : is not a member of 'EnvDTE::_WindowEvents'
1> c:\work\visstudio_addin\cbaddin3\cbaddin3\debug\dte80a.tlh(1006) : see declaration of 'EnvDTE::_WindowEvents'
1>c:\work\visstudio_addin\cbaddin3\cbaddin3\connect.cpp(43) : error C2061: syntax error : identifier '_dispWindowEvents_WindowActivatedEventHandler'