Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to get clipping region of windowless activex?

13 views
Skip to first unread message

Smalti

unread,
Dec 1, 2009, 3:49:31 PM12/1/09
to
How to get it without HWND?
If activex windowed i use GetRandomRgn(GDI) function,
and i want to get clipped region for windowless control the same as
GetRandomRgn do it for windowed.
How to do it?

Igor Tandetnik

unread,
Dec 1, 2009, 4:05:58 PM12/1/09
to

You are given an HDC to draw into. Call GetClipRgn on it.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. -- RFC 1925

Smalti

unread,
Dec 1, 2009, 4:40:38 PM12/1/09
to
On Dec 1, 11:05 pm, "Igor Tandetnik" <itandet...@mvps.org> wrote:

The HDC is device context of its container (window class name:
Internet Explorer_Server), so it has wrong rect and clip region(region
has the ie frame/tab view size).

Igor Tandetnik

unread,
Dec 1, 2009, 5:03:26 PM12/1/09
to
Smalti <sma...@gmail.com> wrote:
> On Dec 1, 11:05 pm, "Igor Tandetnik" <itandet...@mvps.org> wrote:
>> Smalti <smal...@gmail.com> wrote:
>>> How to get it without HWND?
>>> If activex windowed i use GetRandomRgn(GDI) function,
>>> and i want to get clipped region for windowless control the same as
>>> GetRandomRgn do it for windowed.
>>> How to do it?
>>
>> You are given an HDC to draw into. Call GetClipRgn on it.
>
> The HDC is device context of its container (window class name:
> Internet Explorer_Server), so it has wrong rect and clip region(region
> has the ie frame/tab view size).

It's the region the container wants you to restrict your painting to. If the container didn't bother to set the clip region, then it doesn't want to limit where you paint.

I suppose you could get your container's HWND from your client site with IOleInPlaceSite::GetWindow, and get the dirty region from there. Note however that the HDC you are asked to paint into does not necessarily come directly from that window. E.g. the container may choose to double-buffer (ask you, and other controls, to paint themserlves into an off-screen bitmap first, then dump the composite drawing onto the screen - this is a common way to support overlapping controls). Or perhaps it's printing, and the HDC is that of the printer.

Smalti

unread,
Dec 1, 2009, 5:22:54 PM12/1/09
to

So, there are not any legal way to get the current visible region,
because container does not restrict the DC, and
IOleInPlaceSite::GetWindow region has the same behaviour. IE has
private windowless drawning system, so it is difficult to get that
region. Are there any tricks to get round IE?

0 new messages