|
-
May 11th, 2009, 02:49 PM
#1
[RESOLVED] on regions (HRGN)
Hello!
I'm creating a window of arbitrary shape and have some questions about regions. ( I assume they could be generalized to objects. )
Particularly:
1)
Code:
{
register HRGN hRgn = CreateRectRgn( tail, row, head, row+1 );
CombineRgn( hRegion,
hRegion,
hRgn,
RGN_OR
);
DeleteObject( hRgn ); // I do not use hRgn any more. Could(or should) I delete it?
}
2) May/Must/Should I delete a region passed to SetWindowRgn(), if I do not need it any more, but window still exists?
3) I have a function HRGN build_region( HBITMAP hBitmap, COLORREF rgbTransparent ). It builds a region on basis of the bitmap, only non-rgbTransparent pixels form a region. I'm not a native English speaker. Are the names of identifiers correct?
-
May 11th, 2009, 03:04 PM
#2
Re: on regions (HRGN)
 Originally Posted by andrey_zh
2) May/Must/Should I delete a region passed to SetWindowRgn(), if I do not need it any more, but window still exists?
Check API documentation on MSDN. It is clearly mentioned there.
-
May 11th, 2009, 04:09 PM
#3
Re: on regions (HRGN)
From MSDN:
After a successful call to SetWindowRgn, the system owns the region specified by the region handle hRgn. The system does not make a copy of the region. Thus, you should not make any further function calls with this region handle. In particular, do not delete this region handle. The system deletes the region handle when it no longer needed.
That's clear. Thanks!
What about CombineRgn()? MSDN seems to be rather laconic on it:
http://msdn.microsoft.com/en-us/libr...65(VS.85).aspx
Last edited by andrey_zh; May 11th, 2009 at 04:12 PM.
-
May 11th, 2009, 07:39 PM
#4
Re: on regions (HRGN)
 Originally Posted by andrey_zh
What about CombineRgn()?
After CombineRgn() returns, both source regions are no longer used (unless, of course, one of them is also used as a destination region).
Also, I wouldn't use "register" with any modern compilers, unless you are 100% sure you can make that call (what to use registers for) better than compiler.
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio:
FeinWindows - replacement windows manager for Visual Studio, and more...
-
May 12th, 2009, 11:03 AM
#5
Re: on regions (HRGN)
Which tool could I use to determinate an "object leak"?
What will be the result if occurs/after app closes on modern Windows ( NT-family )?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|