Reputation: 131
After passing a pointer to a RECT
struct to AdjustWindowRect()
, Windows fills out the left
, top
, right
, and bottom
fields for me. I can easily enough calculate the width and the height I need from the fields, but I noticed something in the Visual Studio debugger. In the Value column of the Watch window, the value for the RECT
variable (AdjustedWindowRect
) shows a grouping of the fields that I'm not used to (LT
& RB
, which I assume to mean left/top & right/bottom) and also displays the width and height in braces at the end. Is this just a feature of the debugger, or can I access the width and height values from the struct without having to do the calculations in the code?
Upvotes: 0
Views: 483
Reputation: 21956
You can’t. It’s formatted by the debugger. Specifically, see this XML:
<Type Name="tagRECT">
<AlternativeType Name="CRect"></AlternativeType>
<DisplayString>{{LT({left}, {top}) RB({right}, {bottom}) [{right-left} x {bottom-top}]}}</DisplayString>
</Type>
That code is from in windows.natvis
file, on my PC it’s in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Packages\Debugger\Visualizers\
.
BTW, you can easily add custom visualizers for your own types, write a similar *.natvis file, include in project, and the IDE will use it for debugging.
Upvotes: 1