tags:

views:

36

answers:

2

Hello,

I'm using one 3rd party SDK which get hwnd (window handle) and paints something on my window. And i want to specify window painting region (left, right, top, bottom) ? How it's possible to do it ? I'm found WINAPI function SetWindowRgn, but it's not good for me because this function specify whole window region. I need specify just window painting area.

+2  A: 

SetWindowRgn() is exactly what you need. You can create your region from a rectangle using CreateRectRgn(). A good introduction to window regions can be found here.

Alternatively you can modify the non-client area of your window, but I would not recommend that, because it has several side-effects.

+1  A: 

If it's possible to give this library an HDC instead of the window handle - you should do this. That is, get the drawing DC for your window's client area (GetDC), create the needed clipping region, and set it (SelectClipRgn).

In case your library insists on accepting the window handle - I can propose the following solution:

Inside your window create another child window, set the appropriate region for it. And give the handle of that window to your library.

valdo
Thanks, I created another child window.
kesrut