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
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.
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?