using System;
using System.Drawing;
public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
uint appID1 = BFS.Application.GetAppIDByFile("*notepad++.exe");
while (true)
{
windowHandle = BFS.Application.GetMainWindowByAppID(appID1);
if (windowHandle != IntPtr.Zero)
break;
else
BFS.Application.Start("C:\\Program Files\\Notepad++\\notepad++.exe", "");
break;
}
}
}using System;
using System.Drawing;
public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
// Set the Window Position Profile name, window title, application path, and arguments here
string windowPositionProfile = "profile name";
string windowTitle = "*Notepad*";
string appPath = @"C:\Windows\system32\notepad.exe";
string appArgs = "";
// Try to get the window
IntPtr window = BFS.Window.GetWindowByText(windowTitle);
// If the handle is null, launch it and apply the Window Position Profile
if (window == IntPtr.Zero)
{
BFS.Application.Start(appPath, appArgs);
BFS.DisplayFusion.LoadWindowPositionProfile(windowPositionProfile);
}
// Otherwise, give it focus
else
{
BFS.Window.Focus(window);
}
}
}using System;
using System.Drawing;
using System.Collections.Generic;
public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
// Set the Window Position Profile name, window title, application path, and arguments here
string windowPositionProfile = "profile name";
List<(string windowTitle, string appPath, string appArgs)> applications = new() {
new("*Notepad++",@"C:\Program Files\Notepad++\notepad++.exe",""),
new ("*LogFusion*",@"C:\Program Files\LogFusion\LogFusion.exe","")
};
foreach (var application in applications)
{
string windowTitle = application.windowTitle;
string appPath = application.appPath;
string appArgs = application.appArgs;
// Try to get the window
IntPtr window = BFS.Window.GetWindowByText(windowTitle);
// If the handle is null, launch it and apply the Window Position Profile
if (window == IntPtr.Zero)
{
BFS.Application.Start(appPath, appArgs);
BFS.DisplayFusion.LoadWindowPositionProfile(windowPositionProfile);
}
// Otherwise, give it focus
else
{
BFS.Window.Focus(window);
}
}
}
}