Link to home
Start Free TrialLog in
Avatar of RodneyYeo
RodneyYeo

asked on

CWnd::GetWindowRgn()

I've tried using the above method but i can't seems to get the value for HRGN and the return value is always ERROR(that is 0). Any clue?
Avatar of Vinayak Kumbar
Vinayak Kumbar

Hi,

Yes, I am also facing the same problem. So I will be interested in the answer. But What I am thinking to do is,

Use CWnd::GetClientRect() then using that rectangle
CRgn::CreateRectRgn()

So that I will have the Rgn in CRgn object.

Thanks,
Try to use SetWindowRgn and after that GetWindowRgn.
Avatar of RodneyYeo

ASKER

But what's the point of having that method under window? if in the end, I still have to do what VinExpert has suggested. Anyway, thanks for your suggestion MichaelS.
In this way we can test your code. For sure will be more easy to see it directly here.
Actually I'm thinking about the reason Microsoft have for putting that method in. Look kinda silly setting and getting the value back again. I'm very sure there must be a specific purpose for this method :)
Didn't catch your last comment, sorry.
ASKER CERTIFIED SOLUTION
Avatar of Zoppo
Zoppo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
sorry, wanted to post it as a comment and with only one signature, sorry...
You have to create a region and pass the HRGN of that region to CWnd::GetWindowRgn. You can't pass an invalid HRGN to it.
Thanks for your information. I got the picture.
and thanks for all those who have help in one way or another :)