I'm currently busy making dockable tool windows for my program. I've conceived a "dock server" window that permits its "dock clients" (the tool windows) to become its children, along with another window which is the application workspace. I feel a tree coming on...
Application Frame Window
         Dock Server-----------------------Undocked Tool Windows
              |                       \
       Workspace Window           Docked Tool Windows
In my indeed infinite wisdom, I decreed that the dock server should be an "invisible" window, i.e. although it has a region that covers the client area of the frame window, it is transparent. With that in mind, I set its extended style to WS_EX_TRANSPARENT.

This works fine until I actually dock a tool window and the workspace window is resized to give the docked window room. Because the frame window's style includes WS_CLIPCHILDREN, it doesn't erase the background underneath its children. This would normally be good (prevents flickering), but for a transparent window...

So, I tried using this in my dock server's WindowProc:-
    HRGN hRgn, hrgnChild;
    RECT rc;
    t_dockserver *info;

    hRgn = CreateRectRgn(0, 0, 0, 0);
    // Got update?
    if (GetUpdateRgn(hWnd, hRgn, FALSE) != NULLREGION)
        info = (t_dockserver *)GetWindowLong(hWnd, 0);
        // Do we have a workspace?
        if (info->hwndChild)
            // Clip it from the update region
            GetWindowRect(info->hwndChild, &rc);
            MapWindowPoints(NULL, hWnd, (LPPOINT)&rc, 2);
            hrgnChild = CreateRectRgnIndirect(&rc);
            CombineRgn(hRgn, hRgn, hrgnChild, RGN_DIFF);

        // Redraw this bit please
        InvalidateRgn(GetParent(hWnd), hRgn, TRUE);

    return TRUE;
This doesn't quite work, however. Any ideas?