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?

User Image
Jcee
205 discussion posts
Is there any chance this function can be made to work on fullscreen(windowed) games?
Jul 8, 2015  • #1
Keith Lammers (BFS)'s profile on WallpaperFusion.com
To clarify, are you wanting the TitleBar Button to show up on the game windows, or just wanting to use the key combination? The key combination should already work for windowed games, but the catch is that some games don't allow global hotkeys to run while the game is focused, so it might ignore the DF key combinations.
Jul 9, 2015  • #2
User Image
Jcee
205 discussion posts
UPDATE: It seems the issue was with the script . which for whatever reason works fine on regular windowed applications.

I have figured out a workaround; by adding:
BFS.DisplayFusion.RunFunction("Prevent Window Deactivation (keeps game windows focused)");
to the start, and end of the script, I am now able to throw fullscreen(windowed) applications back and forth properly. Ill update if I find any unintended side effects.

PS is there a way to disable the sound made when that function runs?

Code

using System;
using System.Drawing;
using System.Windows.Forms;

// 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)
{
//these are all of the functions from the "Window Management" functions list
//the function are just called by their names. to find their names, you can copy them
//from the context menus, or type "BFS.DisplayFusion.RunFunction(" and a window will come up
//with all of the available functions
//"--- Abbrechen ---" is german for "cancel". Used to cancel the action, see below "MenuItem_Click"
BFS.DisplayFusion.RunFunction("Prevent Window Deactivation (keeps game windows focused)");

string[, ,] MenuEntries = 
{
//{{ "Background-Color", "Foreground-Color", "Function-Name" }}
{{ "WhiteSmoke", "Black", "Move Window to Next Monitor" }},
{{ "White", "Black", "Span Window Across all Monitors" }},
{{ "WhiteSmoke", "Black", "Minimize Window To System Tray" }},
{{ "White", "Black", "Minimize All Windows Except Current Window (All Monitors)" }},
{{ "WhiteSmoke", "Black", "Toggle Window Always on Top" }},
{{ "White", "Black", "Lock/Unlock Mouse Cursor to Current Focused Window" }},
{{ "WhiteSmoke", "Black", "Full-Screen(Windowed)" }},

{{ "White", "Black", "Prevent Window Deactivation (keeps game windows focused)" }},
{{ "White", "Black", "Dim Second Screen" }}

};

//create a new ContextMenuStrip to show the items
using(ContextMenuStrip menu = new ContextMenuStrip())
{
//dont show the padding on the left of the menu
menu.ShowCheckMargin = false;
menu.ShowImageMargin = false;

//add items to the menu, and use our custom function when a user clicks on the items
for ( int i = 0; i < ( MenuEntries.Length / MenuEntries.Rank ); i++ )
{
menu.Items.Add(MenuEntries[i, 0, 2]);
menu.Items[menu.Items.Count - 1].Click += MenuItem_Click;
menu.Items[menu.Items.Count - 1].BackColor = Color.FromName( MenuEntries[i, 0, 0]);
menu.Items[menu.Items.Count - 1].ForeColor = Color.FromName( MenuEntries[i, 0, 1]);
}

//if the menu will show on the screen, show it. otherwise, show it above the mouse
if(BFS.Monitor.GetMonitorBoundsByMouseCursor().Contains(new Point(BFS.Input.GetMousePositionX(), BFS.Input.GetMousePositionY() + menu.Height)))
menu.Show(BFS.Input.GetMousePositionX(), BFS.Input.GetMousePositionY());
else
menu.Show(new Point(BFS.Input.GetMousePositionX(), BFS.Input.GetMousePositionY()), ToolStripDropDownDirection.AboveRight);

//set focus to the menu
BFS.Window.Focus(menu.Handle);

//wait for the menu to close
while(menu.Visible)
Application.DoEvents();

BFS.DisplayFusion.RunFunction("Prevent Window Deactivation (keeps game windows focused)");
}
}

//this function will get the text of the item and try to run it as a DisplayFusion function
//"--- Abbrechen ---" (Cancel), change it to what you used in MenuEntries-List
private static void MenuItem_Click(object sender, EventArgs e)
{
ToolStripItem item = sender as ToolStripItem;
if (item == null || item.Text == "--- Abbrechen ---")
return;

BFS.DisplayFusion.RunFunction(item.Text);
}
}
Jul 9, 2015  • #3
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Awesome, glad to hear you were able to find a solution!
Jul 10, 2015  • #4
User Image
Nhan Anh Ha
2 discussion posts
Hey, how can I move a full screen window to another monitor when I press the key combination instead of a menu pop up? Also how do i disable the sound
Jan 9, 2024  • #5
User Image
cbns
36 discussion posts
i would like to know how to do the opposite. i want the "move window to next monitor" under functinos to ignore fullscreen games.

is there someway to set exceptions for applications or something?
Dec 19, 2024  • #6
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
You're looking to send the window to the next monitor, behind a full screen window?
Dec 20, 2024  • #7
User Image
cbns
36 discussion posts
Quote:
You're looking to send the window to the next monitor, behind a full screen window?

No, I have a game that is fullscreen and sometimes I will accidentally hit the function and the game will move to another monitor.

i.e. I'm looking for a way to exclude applications from triggers
Dec 21, 2024  • #8
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
Ah, you can add the Window text from the app with a minus symbol in front to exclude it. For example, this would prevent it from firing on an app with the window text "notepad":

-notepad
Dec 30, 2024  • #9
User Image
cbns
36 discussion posts
Thanks, but where do I add this? It is a standard function thjat ocmes with the program, and under Functions> Move window to next monitor I can only edit the hotkey to activvate it
Dec 30, 2024  • #10
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
I've attached a script below that should do this. You can import it via the DisplayFusion Settings > Functions > Scripted Function > Import Scripted Function.

This script will check if the focused window is a full screen application, if not, it will fire the Move to next monitor function.

Thanks!
Jan 7, 2025  • #11
User Image
cbns
36 discussion posts
Quote:
I've attached a script below that should do this. You can import it via the DisplayFusion Settings > Functions > Scripted Function > Import Scripted Function.

This script will check if the focused window is a full screen application, if not, it will fire the Move to next monitor function.

Thanks!


Thank you! How very kind of you
Jan 8, 2025  • #12
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)