[MACRO][VS2008] Add a "When Hit" Breakpoint with a macroHi everyone, <div><br/></div> <div>I would like to add some breakpoints from my macro. I manage to do this easily thanks to the EnvDte.Breakpoint interface. But I would like to create a &quot;When hit&quot; breakpoint and to associate this breakpoint with a macro (to execute the macro when the breakpoint is reached).</div> <div><br/></div> <div>I've not found any property/method in the objectmodel to help doing this. Do I miss something ?</div> <div><br/></div> <div><br/></div>© 2009 Microsoft Corporation. All rights reserved.Wed, 08 Jul 2009 03:01:02 Zf80f2d70-b4f1-4574-861f-9e59b2bd513bhttp://social.msdn.microsoft.com/Forums/en-US/vsx/thread/f80f2d70-b4f1-4574-861f-9e59b2bd513b#f80f2d70-b4f1-4574-861f-9e59b2bd513bhttp://social.msdn.microsoft.com/Forums/en-US/vsx/thread/f80f2d70-b4f1-4574-861f-9e59b2bd513b#f80f2d70-b4f1-4574-861f-9e59b2bd513bPatrice Lamarchehttp://social.msdn.microsoft.com/Profile/en-US/?user=Patrice%20Lamarche[MACRO][VS2008] Add a "When Hit" Breakpoint with a macroHi everyone, <div><br/></div> <div>I would like to add some breakpoints from my macro. I manage to do this easily thanks to the EnvDte.Breakpoint interface. But I would like to create a &quot;When hit&quot; breakpoint and to associate this breakpoint with a macro (to execute the macro when the breakpoint is reached).</div> <div><br/></div> <div>I've not found any property/method in the objectmodel to help doing this. Do I miss something ?</div> <div><br/></div> <div><br/></div>Tue, 30 Jun 2009 08:38:48 Z2009-06-30T08:38:48Zhttp://social.msdn.microsoft.com/Forums/en-US/vsx/thread/f80f2d70-b4f1-4574-861f-9e59b2bd513b#cf7d8166-3210-4635-b85b-8d080c6844f5http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/f80f2d70-b4f1-4574-861f-9e59b2bd513b#cf7d8166-3210-4635-b85b-8d080c6844f5Nancy Shaohttp://social.msdn.microsoft.com/Profile/en-US/?user=Nancy%20Shao[MACRO][VS2008] Add a "When Hit" Breakpoint with a macroHi Patrice,<br/><br/>Base on my understanding, you want to subscribe to an event that is triggered when the debugger has hit a break point. If so, you can try to use  <strong><a href="http://msdn.microsoft.com/en-us/library/aa291623(VS.71).aspx">DebuggerEvents</a></strong> object to achieve this, the <strong>OnEnterBreakMode</strong> Event will be fired when entering  break mode. Please refer to following code snippet:<br/><br/> <pre lang="x-c#">// Place the following code in the Exec method of the add-in: EnvDTE.DebuggerEvents debugEvents = applicationObject.Events.DebuggerEvents; debugEvents.OnEnterBreakMode += new _dispDebuggerEvents_OnEnterBreakModeEventHandler(DebuggerEvents.BreakHandler); // Place the following Event handler code in the add-in: // Needed to activate event handlers in Connect.Exec. public static void StartEvents(DTE dte) { System.Windows.Forms.MessageBox.Show(&quot;Events are attached.&quot;); } // OnEnterBreakMode Event. public static void BreakHandler(dbgEventReason reason, ref dbgExecutionAction execAction) { System.Windows.Forms.MessageBox.Show(&quot;Debugger enters break mode. &quot; + &quot;Reason: &quot; + reason.ToString()); }</pre> <p> </p> <p>For more information, please see this thread: <span><a href="http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/b694ff04-dac2-4310-9e82-add64f497d5f">SDK Package: wanting to subscribe to the c# debugger onBreakPointHit event</a>.<br/><br/>If I misunderstood you, or you have any questions, please let me know.<br/><br/>Best Regards,<br/>Nancy</span></p><hr class="sig">Please remember to mark the replies as answers if they help and unmark them if they provide no help. <br/> <a href="http://cfx.codeplex.com/">Welcome to the All-In-One Code Framework!</a> If you have any feedback, please tell us.Thu, 02 Jul 2009 07:39:56 Z2009-07-02T07:39:56Z