Problem with Events, WindowEvents, managed C++<span style="font-family:Arial;font-size:14px;border-collapse:collapse;line-height:18px"> <p style="margin-top:0px;margin-right:0px;margin-bottom:1em;margin-left:0px;font-size:14px;vertical-align:baseline;background-image:initial;background-repeat:initial;background-attachment:initial;background-color:transparent;padding:0px;border:0px initial initial">Hello,</p> <p style="margin-top:0px;margin-right:0px;margin-bottom:1em;margin-left:0px;font-size:14px;vertical-align:baseline;background-image:initial;background-repeat:initial;background-attachment:initial;background-color:transparent;padding:0px;border:0px initial initial">Working on a VisStudio 2008 addin, using managed C++ (C++/CLR in the New Project wizard).</p> <p style="margin-top:0px;margin-right:0px;margin-bottom:1em;margin-left:0px;font-size:14px;vertical-align:baseline;background-image:initial;background-repeat:initial;background-attachment:initial;background-color:transparent;padding:0px;border:0px initial initial">In the OnConnection() function, I want to add a handler to the WindowEvents collection.</p> <p style="margin-top:0px;margin-right:0px;margin-bottom:1em;margin-left:0px;font-size:14px;vertical-align:baseline;background-image:initial;background-repeat:initial;background-attachment:initial;background-color:transparent;padding:0px;border:0px initial initial">When I do this:<br/>// Hook up events<br/>EnvDTE::Events ^ events = _applicationObject-&gt;Events;<br/>EnvDTE::WindowEvents ^winEvents = events-&gt;WindowEvents();</p> <p style="margin-top:0px;margin-right:0px;margin-bottom:1em;margin-left:0px;font-size:14px;vertical-align:baseline;background-image:initial;background-repeat:initial;background-attachment:initial;background-color:transparent;padding:0px;border:0px initial initial">I get an error message:<br/>error C2660: 'EnvDTE::Events::WindowEvents::get' : function does not take 0 arguments</p> <p style="margin-top:0px;margin-right:0px;margin-bottom:1em;margin-left:0px;font-size:14px;vertical-align:baseline;background-image:initial;background-repeat:initial;background-attachment:initial;background-color:transparent;padding:0px;border:0px initial initial">In the Object Browser I find this:<br/>public EnvDTE.WindowEvents WindowEvents(EnvDTE.Window WindowFilter = null) { get; }</p> <p style="margin-top:0px;margin-right:0px;margin-bottom:1em;margin-left:0px;font-size:14px;vertical-align:baseline;background-image:initial;background-repeat:initial;background-attachment:initial;background-color:transparent;padding:0px;border:0px initial initial">Thanks for any hints about what I'm doing wrong...</p> </span>© 2009 Microsoft Corporation. All rights reserved.Mon, 06 Jul 2009 17:31:53 Z781aa693-e99d-4273-8e49-5f72db25ab20http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/781aa693-e99d-4273-8e49-5f72db25ab20#781aa693-e99d-4273-8e49-5f72db25ab20http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/781aa693-e99d-4273-8e49-5f72db25ab20#781aa693-e99d-4273-8e49-5f72db25ab20Number8http://social.msdn.microsoft.com/Profile/en-US/?user=Number8Problem with Events, WindowEvents, managed C++<span style="font-family:Arial;font-size:14px;border-collapse:collapse;line-height:18px"> <p style="margin-top:0px;margin-right:0px;margin-bottom:1em;margin-left:0px;font-size:14px;vertical-align:baseline;background-image:initial;background-repeat:initial;background-attachment:initial;background-color:transparent;padding:0px;border:0px initial initial">Hello,</p> <p style="margin-top:0px;margin-right:0px;margin-bottom:1em;margin-left:0px;font-size:14px;vertical-align:baseline;background-image:initial;background-repeat:initial;background-attachment:initial;background-color:transparent;padding:0px;border:0px initial initial">Working on a VisStudio 2008 addin, using managed C++ (C++/CLR in the New Project wizard).</p> <p style="margin-top:0px;margin-right:0px;margin-bottom:1em;margin-left:0px;font-size:14px;vertical-align:baseline;background-image:initial;background-repeat:initial;background-attachment:initial;background-color:transparent;padding:0px;border:0px initial initial">In the OnConnection() function, I want to add a handler to the WindowEvents collection.</p> <p style="margin-top:0px;margin-right:0px;margin-bottom:1em;margin-left:0px;font-size:14px;vertical-align:baseline;background-image:initial;background-repeat:initial;background-attachment:initial;background-color:transparent;padding:0px;border:0px initial initial">When I do this:<br/>// Hook up events<br/>EnvDTE::Events ^ events = _applicationObject-&gt;Events;<br/>EnvDTE::WindowEvents ^winEvents = events-&gt;WindowEvents();</p> <p style="margin-top:0px;margin-right:0px;margin-bottom:1em;margin-left:0px;font-size:14px;vertical-align:baseline;background-image:initial;background-repeat:initial;background-attachment:initial;background-color:transparent;padding:0px;border:0px initial initial">I get an error message:<br/>error C2660: 'EnvDTE::Events::WindowEvents::get' : function does not take 0 arguments</p> <p style="margin-top:0px;margin-right:0px;margin-bottom:1em;margin-left:0px;font-size:14px;vertical-align:baseline;background-image:initial;background-repeat:initial;background-attachment:initial;background-color:transparent;padding:0px;border:0px initial initial">In the Object Browser I find this:<br/>public EnvDTE.WindowEvents WindowEvents(EnvDTE.Window WindowFilter = null) { get; }</p> <p style="margin-top:0px;margin-right:0px;margin-bottom:1em;margin-left:0px;font-size:14px;vertical-align:baseline;background-image:initial;background-repeat:initial;background-attachment:initial;background-color:transparent;padding:0px;border:0px initial initial">Thanks for any hints about what I'm doing wrong...</p> </span>Thu, 02 Jul 2009 16:48:25 Z2009-07-02T16:48:25Zhttp://social.msdn.microsoft.com/Forums/en-US/vsx/thread/781aa693-e99d-4273-8e49-5f72db25ab20#081053e2-c510-436d-8902-e04145fd8e75http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/781aa693-e99d-4273-8e49-5f72db25ab20#081053e2-c510-436d-8902-e04145fd8e75Wesley Yaohttp://social.msdn.microsoft.com/Profile/en-US/?user=Wesley%20YaoProblem with Events, WindowEvents, managed C++Hello,<br/><br/>Actually, property WindowEvents has no default parameter, not sure why it shows on Object Browser, this is the documentation on MSDN: <a href="http://msdn.microsoft.com/en-us/library/envdte.events.windowevents.aspx">Events<span class=cs>.</span>WindowEvents Property</a>.<br/>Please pass 'null' to use it.<br/><br/>Sincerely,<br/>Wesley<hr class="sig">Please mark the replies as answers if they help and unmark them if they provide no help. <a href="http://cfx.codeplex.com/">Welcome to the All-In-One Code Framework!</a> If you have any feedback, please tell us.Mon, 06 Jul 2009 09:23:32 Z2009-07-06T09:23:32Zhttp://social.msdn.microsoft.com/Forums/en-US/vsx/thread/781aa693-e99d-4273-8e49-5f72db25ab20#b86eb808-e43e-4273-95f4-6b29ee26f074http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/781aa693-e99d-4273-8e49-5f72db25ab20#b86eb808-e43e-4273-95f4-6b29ee26f074Number8http://social.msdn.microsoft.com/Profile/en-US/?user=Number8Problem with Events, WindowEvents, managed C++Thanks for the reply. <div>Doesn't the Object Browser get its information from metadata in the assembly?  It seems to be consistent with the doc you linked to:</div> <div> <pre>Parameters WindowFilter Type: EnvDTE.Window Optional. If supplied, window events occur only for the specified Window. </pre> <div>Reflector reports the same:  parameter is optional, default is null.</div> <div><br/></div> Anyway, trying to pass a parameter:</div> <div> <pre>EnvDTE::WindowEvents ^we = events-&gt;WindowEvents(0);</pre> <div>1&gt;Compiling...</div> <div>1&gt;Connect.cpp</div> <div>1&gt;.\Connect.cpp(27) : error C2660: 'EnvDTE::Events::WindowEvents::get' : function does not take 0 arguments</div> <div><br/></div> <div> <pre>EnvDTE::WindowEvents ^we = events-&gt;WindowEvents(nullptr);<span style="font-family:Verdana"><span style="white-space:normal"> </span></span></pre> <div>1&gt;Compiling...</div> <div>1&gt;Connect.cpp</div> <div>1&gt;.\Connect.cpp(27) : error C2660: 'EnvDTE::Events::WindowEvents::get' : function does not take 0 arguments</div> <div><br/></div> <div><br/></div> <div>Is there a possible compiler setting problem?</div> <div><br/></div> </div> </div>Mon, 06 Jul 2009 11:34:48 Z2009-07-06T11:38:56Zhttp://social.msdn.microsoft.com/Forums/en-US/vsx/thread/781aa693-e99d-4273-8e49-5f72db25ab20#d94177fe-4aa2-49cf-b12d-f428272b332chttp://social.msdn.microsoft.com/Forums/en-US/vsx/thread/781aa693-e99d-4273-8e49-5f72db25ab20#d94177fe-4aa2-49cf-b12d-f428272b332cNumber8http://social.msdn.microsoft.com/Profile/en-US/?user=Number8Problem with Events, WindowEvents, managed C++Solution: <div>_winEvents = events-&gt;WindowEvents[nullptr];</div> <div><br/></div> <div>(Note square brackets.)</div>Mon, 06 Jul 2009 17:31:43 Z2009-07-06T17:31:43Z