Is it possible to show in one application window (maximized) live screens of another applications that are running concurrently.
I have the following conceptual idea (see below screenshot): the main application is showing while multiple excel applications are running concurrently. Instead of clicking (or tabbing) between applications or resize these windows to be shown on screen, I would want to simply have the main application maximized to show life screens of all these opened excel workbooks.

I use periodic calls to PrintWindow for that.
I'm not completely happy with this solution for it seems a bit hacky. But it also scans hidden windows.
The code is
[DllImport("User32.dll")]
public static extern bool PrintWindow(IntPtr hWnd, IntPtr hdcBlt, int nFlags
[StructLayout(LayoutKind.Sequential)]
struct RECT
{
    public int Left;
    public int Top;
    public int Right;
    public int Bottom;
}
public static Bitmap GetWindow(IntPtr hWnd)
{
    RECT rect;
    GetWindowRect(hWnd, out rect);
    int width = rect.Right - rect.Left;
    int height = rect.Bottom - rect.Top;
    if (width > 0 && height > 0)
    {
        // Build device context (dc)
        Bitmap bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
        Graphics gfxBmp = Graphics.FromImage(bmp);
        IntPtr hdcBitmap = gfxBmp.GetHdc();
        // drawing options
        int nFlags = 0;
        // execute call
        PrintWindow(hWnd, hdcBitmap, nFlags);
        // some clean-up
        gfxBmp.ReleaseHdc(hdcBitmap);
        gfxBmp.Dispose();
        return bmp;
    }
    else
    {
        return null;
    }
} // end function getWindow
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With