GDI - how to get RECT from HRGN region

Started by
3 comments, last by Buckeye 9 years, 7 months ago

I'm new to GDI and I'm trying to figure out how to get a RECT object (with bottom,left,top,right coordinates in logical units) from a HRGN handle of the clipping region.

Is there a way to do this or am I getting something wrong in how to use them?

Advertisement

To answer your question directly: unfortunately, you can't. sad.png

FYI: RECT is not a GDI object, it's just a structure. HRGN is a GDI object, like pens and brushes.. In addition, a region can be more than a rectangle - it can be elliptical, a polygon and even combined with other regions with logical operators such as RGN_OR, RGN_AND, etc., to form a COMPLEXREGION.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

GetRgnBox()

MSDN

I used to write a LOT of Win32 code, and for the most part really like the way Windows works. However, I've always pathologically despised regions angry.png

Thanks to both of you! Very much appreciated smile.png

Unfortunately this stuff is very poor documented, I should get a copy of Petzold's book I suppose. Thanks!


I should get a copy of Petzold's book I suppose.

Well.. I didn't find GetRgnBox in the 5th edition. huh.png But it's in the MS Help for Visual Studio, bigger than life. Thumbs up to mark ds for finding that.

EDIT: Having said that, it's an excellent book for the Windows API. It is not an encyclopedia for the API, but there are good compile-first-time examples for beginner-to-intermediate level.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

This topic is closed to new replies.

Advertisement