[python-win32] HRGN, RGNDATA, RGNDATAHEADER

Henry Baxter henry.baxter at gmail.com
Tue Jan 15 00:34:47 CET 2008


Hello,

I'm having some trouble working with window 'regions'. I need to initialize
some memory for the region and work with it.

I have copied my best approach so far, but I know I don't know what I'm
doing when it comes to the 'Buffer' field in RGNDATA. MSDN describes what
HRGN points to (a RGNDATA struct) as:

typedef struct _RGNDATA {
    RGNDATAHEADER rdh;
    char Buffer[1];
} RGNDATA, *PRGNDATA;
*Buffer* Specifies an arbitrary-size buffer that contains the
*RECT*structures that make up the region.How
do I create an arbitrary-size buffer and initialize it? That doesn't really
make a lot of sense to me.

DWORD = c_ulong

class RECT(Structure):
    _fields_ = [('left', c_long),
                ('top', c_long),
                ('right', c_long),
                ('bottom', c_long)]

class RGNDATAHEADER(Structure):
    _fields_ = [('dwSize', DWORD),
                ('iType', DWORD),
                ('nCount', DWORD),
                ('nRgnSize', DWORD),
                ('rcBound', RECT)]

class RGNDATA(Structure):
    _fields_ = [('rdh', RGNDATAHEADER),
                ('Buffer', c_void_p)]

HRGN = POINTER(RGNDATA)

Specifically I am looking to use SetWindowRgn, CreateRoundRectRgn,
CreatePolygonRgn, and possibly modify the RGNDATA structure directly if
possible.



-- 
Henry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20080114/128bb938/attachment.htm 


More information about the python-win32 mailing list