I just came across an interesting use of non-breaking breakpoints. I was debugging a context menu and needed to see when the TPopupMenu.PopupComponent property was assigned. A regular breakpoint doesn’t work so well for this since it interferes with the display of the menu to have the IDE pop up. So I wrote some code like this in the OnContextPopup handler of the form:
var
popupcomp: string;
begin
if Assigned(pmnuPageGroupFrame.PopupComponent) then begin
popupcomp := pmnuPageGroupFrame.PopupComponent.ClassName;
end else begin
popupcomp := '';
end;
end;
Then I put breakpoints on both of the assignments, clicked Breakpoint Properties, and un-checked Break. I put MessageBeep(MB_ICONHAND) in the Eval expression of one and a different beep in the other, and turned off logging on both.
It works OK. The feedback is nice, but it isn’t synchronous. The beep is often delayed until I click back to the IDE or do something else in the app. But that was good enough to answer the question I had. It did make me wonder how accurate non-breaking breakpoints really are for lightweight profiling, though.
{ 1 } Comments
Hi Craig,
This method works only if the MessageBeep function is used by the application. Otherwise, you will get an undefined symbol error.
I found them really irritating.
You also need system sounds
Is the display interference still present when running more than one monitor (the IDE and the debugged program placed on different monitors) ?
Post a Comment