Utilisé l'Assistant Nouveau complément pour créer un projet complémentaire Visual C++/ATL.
code généré:Extension ATL, VS2008: Ajout du gestionnaire d'événements à WindowEvents
HRESULT hr = S_OK;
pApplication->QueryInterface(__uuidof(DTE2), (LPVOID*)&m_pDTE);
pAddInInst->QueryInterface(__uuidof(AddIn), (LPVOID*)&m_pAddInInstance);`
avoir les évènements objet et les WindowEvents:
m_pDTE->get_Events(&m_pEvents);
m_pEvents->get_WindowEvents(0, &m_pWinEvents);
Comment ajouter un gestionnaire d'événements?
if (NULL != m_pWinEvents) {
m_pWinEvents += ????
}
Merci pour toutes les allusions ou références ...
Mise à jour, en essayant la suggestion de Alien01:
m_pWinEvents->WindowActivated += new _dispWindowEvents_WindowActivatedEventHandler(this.WindowActivated);
1> ...
Compiler 1> Connect.cpp
1> c: \ work \ visstudio_addin \ cbaddin3 \ cbaddin3 \ connect.cpp (43): erreur C2039: 'WindowActivated': n'est pas membre de 'EnvDTE :: _ WindowEvents'
1> c: \ work \ visstudi o_addin \ cbaddin3 \ cbaddin3 \ debug \ dte80a.tlh (1006): voir la déclaration de 'EnvDTE :: _ WindowEvents'
1> c: \ work \ visstudio_addin \ cbaddin3 \ cbaddin3 \ connect.cpp (43): erreur C2061: syntaxe erreur: identifiant '_dispWindowEvents_WindowActivatedEventHandler'
Avez-vous défini la fonction WindowActivated dans votre classe? – anand
Oui, j'ai une fonction WindowActivated() dans ma classe. Je crois que les messages d'erreur font référence à m_pWinEvents-> WindowActivated et _dispWindowEvents_WindowActivatedEventHandler. – Number8