Processing Ajax...

Close Dialog


Close Dialog

Close Dialog

Remove Borders and Caption From Window

This function removes the title buttons, title, as well as the border from a window.
Minimum Version
Created By
Thomas Malloch (BFS)
Date Created
Oct 15, 2014
Date Last Modified
Nov 4, 2014

Scripted Function (Macro) Code

using System;
using System.Drawing;
// The 'windowHandle' parameter will contain the window handle for the:
// - Active window when run by hotkey
// - Window Location target when run by a Window Location 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)
		//get the current style of the window 
		BFS.WindowEnum.WindowStyle style = BFS.Window.GetWindowStyle(windowHandle); 
		//if the window has any styling that we don't want, remove it
		if(BFS.Window.HasWindowStyle(BFS.WindowEnum.WindowStyle.WS_CAPTION, windowHandle) ||
			BFS.Window.HasWindowStyle(BFS.WindowEnum.WindowStyle.WS_SYSMENU, windowHandle) ||
			BFS.Window.HasWindowStyle(BFS.WindowEnum.WindowStyle.WS_THICKFRAME__SIZEBOX, windowHandle) ||
			BFS.Window.HasWindowStyle(BFS.WindowEnum.WindowStyle.WS_MINIMIZEBOX, windowHandle) ||
			BFS.Window.HasWindowStyle(BFS.WindowEnum.WindowStyle.WS_MAXIMIZEBOX, windowHandle))
			style &= ~BFS.WindowEnum.WindowStyle.WS_CAPTION;
			style &= ~BFS.WindowEnum.WindowStyle.WS_SYSMENU;
			style &= ~BFS.WindowEnum.WindowStyle.WS_THICKFRAME__SIZEBOX;
			style &= ~BFS.WindowEnum.WindowStyle.WS_MINIMIZEBOX;
			style &= ~BFS.WindowEnum.WindowStyle.WS_MAXIMIZEBOX;
		else //otherwise, make sure that the window has the styling
			style |= BFS.WindowEnum.WindowStyle.WS_CAPTION;
			style |= BFS.WindowEnum.WindowStyle.WS_SYSMENU;
			style |= BFS.WindowEnum.WindowStyle.WS_THICKFRAME__SIZEBOX;
			style |= BFS.WindowEnum.WindowStyle.WS_MINIMIZEBOX;
			style |= BFS.WindowEnum.WindowStyle.WS_MAXIMIZEBOX;
		//set the new style to the window 
		BFS.Window.SetWindowStyle(style, windowHandle);