Save up to 50% in our Spring Sale!
Save up to 50% off any of our desktop apps in our Spring Sale, including DisplayFusion,
ClipboardFusion, FileSeek, iTunesFusion, LogFusion, TrayStatus, and VoiceBot!

Title

Message

Confirm

Want to earn a free DisplayFusion Pro license? We're looking for DisplayFusion translators!
<< DiscussionsReply

Closing Windows

Avatar from Gravatar.com
kiwicanta7
2 discussion posts
Good Afternoon!
I have been trying to get this to work for some time (and my coding is very much non-existent). I found some codes to close windows, but I can't seem to get them to work correctly. I have 3 monitor profiles setup (1 for normal operation, 1 for a game (which works just fine), and 1 for exiting the game and entering editing). I can get everything to pull up just fine when changing the profile to the game, but when trying to switch it to editing I can't seem to get the programs that were pulled up for the game to close. I have been trying to figure it out with this code, but can't seem to get it to work...

using System;
using System.Drawing;

// 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)
{
BFS.Window.Close(windowHandle);
}
}

My understanding is that everywhere it says "windowHandle" I should be putting in the name of the custom Function or Trigger name, but that doesn't seem to work for me. Also is it supposed to be replaced in both locations or only in the BFS.Window.Close line? I've done some very minor coding but I can't seem to get this to function. Also should it be the program.exe name or can I use the custom name that I've given it inthe program? Any help would be greatly appreciated!
Feb 17, 2019  • #1
Keith Lammers (BFS)'s profile on WallpaperFusion.com
How are you calling this Scripted Function? From a Trigger rule, or using a hotkey?
Feb 22, 2019  • #2
Avatar from Gravatar.com
kiwicanta7
2 discussion posts
I'm calling it from a trigger event
Feb 23, 2019  • #3
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Could you attach a screenshot of the edit window for the Trigger so I can see how it's setup?

Thanks!
Feb 25, 2019  • #4
Was this helpful?  Login to Vote  Login to Vote
<< DiscussionsReply