Link to home
Start Free TrialLog in
Avatar of win32
win32

asked on

SetRgn

Hi,, I have a Button, i wanna set the SetRectRgn for that button.

How is that done, I DONT wanna make a new Rgn for and then set the Buttons Rgn to the new Rgn. What I wanna do is obtain a pointer to the region already initialized for the button and modify that rgn, with SetRectRgn!!

Why ?, I don't wanna make a new rgn because it takes memory. Modifying an region that's already initialized is that not an option ?

How is it done ?
ASKER CERTIFIED SOLUTION
Avatar of MichaelS
MichaelS

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
Avatar of win32
win32

ASKER

I want to set the Rgn to another Rect, can I do the DeleteObject, the help file sayes that if you've used the SetWindowRgn(rgn, true), rgn can't be deleted because it is used !
>if you've used the SetWindowRgn(rgn, true), rgn can't be deleted because it is used !

yes, it's true, but when you call SetWindowRgn() system deleted automaticly previous region:

from MSDN
In particular, do not delete this region handle. The system deletes the region handle when it no longer needed
MichaelS is absolutely right:

You want to define the region of your button. There can be 2 situations:

(1) The button had no region before. In that case you MUST create a new region. It's crystal clear.
(2) The button had a region before. In the moment where you call SetWindowRgn, the old region is automatically destroyed by Windows, so you don't lose any memory or resources.

So you see, Windows does it already as resource/memory friendly as possible. No need to do any pointer tricks.

Regards, Madshi.