Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

Confirm
Close Dialog

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
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)