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
Pietro-BO
7 discussion posts
Hi everyone,
I'm a happy DisplayFusion user.

Here's my problem:

- I have an assigned access account which opens an app
- I want the window of that app to go on my 2 screen at a certain size via the trigger "window created"
- I am perfectly able to do that in a non-assigned access account
- When I do this operation in an assigned access account, what happens is that the app opens itself BEFORE DisplayFusion (which is obiously set to run at startup), so the trigger "Window Created" does not work, because DisplayFusion does not detect that window as "new".

I can't solve this, as the operations I can do in an assigned access account are just a few.

Thanks for your help!
Jun 21, 2019  • #1
User Image
Pietro-BO
7 discussion posts
The question, in short, is: is DisplayFusion able to take control of a window which was already open before DisplayFusion starts?
Jun 21, 2019  • #2
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Is it just setup in the Windows startup settings right now? You could disable that, and then use a "DisplayFusion Starts" Trigger to launch the app. That way DF will launch it, then run the Window Created Trigger. Please see this guide for details: Launching and Positioning an Application on Startup
Jun 21, 2019  • #3
User Image
Pietro-BO
7 discussion posts
Thanks Keith for your reply.
No, the app is started via "assigned access" (which is a sort of kiosk mode native in Windows). I need that because the system should be fully locked (I want to use the PC as a public PC). That's why DF launches AFTER that app.
What I need to do is to identify that window to resize it, even if DF is launched after that window.
Jun 21, 2019 (modified Jun 21, 2019)  • #4
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Ok, is that app just a single window? If so, this could be done with a Scripted Function. Let me know what the process name is and I'll send over an example :)
Jun 21, 2019  • #5
User Image
Pietro-BO
7 discussion posts
Oh, great! YEs, it's a simple window. You can use an example name for now :)
EDIT: we don't really have a process in this case, as it's an "Application", which is treated in a different way by Windows. I think that the best thing in this case is to use "window" instead of process.
Jun 21, 2019 (modified Jun 21, 2019)  • #6
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Ok, here's a sample:

Code

using System;
using System.Drawing;

public static class DisplayFusionFunction
{
    public static void Run(IntPtr windowHandle)
    {
        IntPtr window = BFS.Application.GetMainWindowByFile("*notepad.exe");
        BFS.Window.MoveToMonitor(2, window);
    }
}


You just need to change the process name, and if you want to do size and location instead of just a move, you can use:
BFS.Window.SetSizeAndLocation(window, x, y, width, height);


Hope that helps!
Jun 21, 2019 (modified Jun 21, 2019)  • #7
User Image
Pietro-BO
7 discussion posts
thanks so much.
since the app is UWP, we don't have a ".exe" process.
maybe I can look for the window with a code like:

.GetWindowByText ("*AppNAME*");

Will it work? I'm going to test.
Jun 21, 2019  • #8
Keith Lammers (BFS)'s profile on WallpaperFusion.com
That will work, yep!
Jun 21, 2019  • #9
User Image
Pietro-BO
7 discussion posts
Hi Keith,
I'm a little in trouble executing your script :)
Can you please edit that for me?
I need a script that:
- get the window by a certain text (improtant! not by process)
- move that window up and left on screen 1
- resize that window to a certain size (width / height).

Can you help me?

Thank you for your precious help.
Jun 24, 2019  • #10
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Ok, try this out. This example moves the Windows Calendar app to the top-left of monitor 1 and sizes it to 800x600.

Code

using System;
using System.Drawing;

public static class DisplayFusionFunction
{
    public static void Run(IntPtr windowHandle)
    {
        // Set the monitor ID, window title, and the window width/height here
        uint monitorID = 1;
        string windowTitle = "*Calendar*";
        int windowWidth = 800;
        int windowHeight = 600;
    
        // Find the window
        IntPtr window = BFS.Window.GetWindowByText(windowTitle);
        
        // Get the monitor bounds
        Rectangle monitorBounds = BFS.Monitor.GetMonitorBoundsByID(monitorID);

        // Move the window
        BFS.Window.SetSizeAndLocation(window, monitorBounds.X, monitorBounds.Y, windowWidth, windowHeight);
    }
}
Jun 24, 2019  • #11
User Image
Pietro-BO
7 discussion posts
Hi Keith,

thanks so much. This solved the problem perfectly in a "normal" environment, great support.
Unfortunately, it looks like that DF is not able to resize a window when in kiosk mode.

Thanks again
Jun 26, 2019  • #12
Keith Lammers (BFS)'s profile on WallpaperFusion.com
No worries! If the kiosk mode for the app is to run it native full screen, then DisplayFusion definitely won't be able to resize it :(

Please let us know if you have any further questions at all.

Thanks!
Jun 26, 2019  • #13
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)