Eventi in C ++ gestito: Problema con Eventi, WindowEvents
-
21-08-2019 - |
Domanda
Lavorare su un VisStudio 2008 componente aggiuntivo, utilizzando gestita C ++ (C ++ / CLR nella procedura guidata Nuovo progetto).
Nella funzione OnConnection (), voglio aggiungere un gestore alla collezione WindowEvents.
Quando faccio questo:
// Collegare eventi
EnvDTE :: Eventi ^ eventi = _applicationObject-> Eventi;
EnvDTE :: WindowEvents ^ winEvents => eventi- WindowEvents ();
Ho ricevuto un messaggio di errore:
errore C2660: 'EnvDTE :: Eventi :: :: WindowEvents ottenere': la funzione non accetta 0 argomenti
Nel Visualizzatore oggetti trovo questo:
EnvDTE.WindowEvents pubblici WindowEvents (EnvDTE.Window WindowFilter = null) {get; }
Grazie per eventuali suggerimenti su quello che sto facendo male ...
Soluzione 2
Trovato la risposta:
EnvDTE::Events ^ events = _applicationObject->Events;
_winEvents = events->WindowEvents[nullptr];
Si notino le parentesi quadre ...
Altri suggerimenti
Prova
EnvDTE::WindowEvents ^winEvents = events->WindowEvents;
senza il (). WindowEvents è un non di proprietà di un metodo.