Processing Ajax...

Title

Message

Confirm

Confirm

Confirm

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure?
If you are experiencing any issues with your desktop wallpaper or taskbar buttons
please download and install the latest DisplayFusion beta version before contacting support.

User Image
Guernsey Zoo
3 discussion posts
I can capture the active window with ALT+PrtScn, but it includes any TitleBar Buttons in the capture.

Is there any way to be able to create a capture of the active window (or the entire desktop) without capturing title bar buttons?
• Attachment: Picture1.png [602,485 bytes]
Picture1.png
Picture1.png
20 days ago  • #1
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
There isn't a way to remove them automatically from screen captures, but we have a function that you can add a hotkey to, for toggling the titlebar buttons on/off that should help here.
20 days ago  • #2
User Image
JLJTGR
139 discussion posts
You can try this to capture a window...

Code

using System;
using System.Drawing;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Windows.Forms;

// The 'windowHandle' parameter will contain the window handle for the:
//   - Active window when run by hotkey
//   - Trigger target when run by a Trigger rule
//   - TitleBar Button owner when run by a TitleBar Button
//   - Jump List owner when run from a Taskbar Jump List
//   - Currently focused window if none of these match
public static class DisplayFusionFunction
{
    public static void Run(IntPtr windowHandle)
    {
        try
        {
            Bitmap bmp = PrintWindow(windowHandle);
            Clipboard.SetImage(bmp);
        }
        catch (System.Exception ex)
        {
            BFS.Dialog.ShowTrayMessage($"Error capturing window: {ex.Message}");
        }
    }

    [DllImport("user32.dll")]
    public static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
    [DllImport("user32.dll")]
    public static extern bool PrintWindow(IntPtr hWnd, IntPtr hdcBlt, int nFlags);

    public static Bitmap PrintWindow(IntPtr hwnd)
    {
        RECT rc;
        GetWindowRect(hwnd, out rc);

        Bitmap bmp = new Bitmap(rc.Width, rc.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
        Graphics gfxBmp = Graphics.FromImage(bmp);
        IntPtr hdcBitmap = gfxBmp.GetHdc();

        PrintWindow(hwnd, hdcBitmap, 0);

        gfxBmp.ReleaseHdc(hdcBitmap);
        gfxBmp.Dispose();

        return bmp;
    }
    [StructLayout(LayoutKind.Sequential)]
    public struct RECT
    {
        private int _Left;
        private int _Top;
        private int _Right;
        private int _Bottom;

        public RECT(int Left, int Top, int Right, int Bottom)
        {
            _Left = Left;
            _Top = Top;
            _Right = Right;
            _Bottom = Bottom;
        }

        public int Height
        {
            get    { return _Bottom - _Top; }
            set { _Bottom = value + _Top; }
        }
        public int Width
        {
            get { return _Right - _Left; }
            set { _Right = value + _Left; }        
        }
    }
}

It will have the side effect of replacing the usual title bar with one that looks like Vista... but it won't have DF icons. For your example that has no real titlebar to begin with, it might simply do what you want.
14 days ago  • #3
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)