Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than gdi32, prefix the name with the module name and a period.
GetRegionData (gdi32)
.
C# Signature:
[DllImport("gdi32.dll")]
static extern int GetRegionData(IntPtr hRgn, uint dwCount,
IntpTR lpRgnData);
User-Defined Types:
None.
Notes:
None.
Tips & Tricks:
Please add some!
Sample Code:
// First get the size in bytes of the region data for the
using System.Interop.Services;
unsafe RECT[] RectsFromRegion(IntPtr hRgn)
{
RECT [] rects = null;
int regionDataSize = GetRegionData(hRgn, 0, IntPtr.Zero);
if (regionDataSize != 0)
{
IntPtr bytes = IntPtr.Zero;
// Allocate as much space as the GetRegionData call
// said was needed
bytes = Marshal.AllocCoTaskMem(regionDataSize);
// Now, make the call again to actually get the data
int retValue = GetRegionData(hRgn, regionDataSize, bytes);
// From here on out, we have the data in a buffer, and we
// just need to convert it into a form that is more useful
// Since pointers are used, this whole routine is 'unsafe'
// It's a small sacrifice to make in order to get this to work.
RGNDATAHEADER * header = (RGNDATAHEADER)bytes;
if (header->iType == RDH_RECTANGLES)
{
RECT
}
}
}
Alternative Managed API:
Do you know one? Please contribute it!
The GetRegionData API
5/30/2008 2:32:45 AM - -167.127.24.25
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).