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?

User Image
Pan Peeter
16 discussion posts
Hi

I need a script that expands and center active window

Heigth 1400
Width 1800

Screen is 5400 x 1400 pix

I explect that command

Code

SetSizeAndLocation(IntPtr windowHandle, int x, int y, int width, int height);


can be used, but when I tried DF crashed

Thanks up front!
Jun 7, 2023  • #1
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
You can use a custom function to do that, you can find our guide on custom functions here: https://www.displayfusion.com/HelpGuide/CustomFunctions/
Jun 7, 2023  • #2
User Image
Pan Peeter
16 discussion posts
Quote:
You can use a custom function to do that, you can find our guide on custom functions here: https://www.displayfusion.com/HelpGuide/CustomFunctions/


Thanks, I have a running finction that place windows in center of screen, but I want it to have heigth = 1400, and width = 2000, when I try this DP crashes:

//SetSizeAndLocation(IntPtr windowHandle, int x, int y, int width, int height);

Code

SetSizeAndLocation(IntPtr windowHandle, int 1000, int 0, int 2000, int 1400);
Jun 8, 2023  • #3
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
You can set the specified width/height in a custom function as well, but if you need it done via a scripted function, you can cut out the variables you're declaring inside the brackets. It should look like this:

Code

BFS.Window.SetSizeAndLocation(windowHandle, 1000, 0, 2000, 1400);


Hope that helps!
Jun 8, 2023  • #4
User Image
Pan Peeter
16 discussion posts
Hi. This worked, center window, se picture

Now I want to use the function :Center Window Ignoring Splits (run again to restore position)
using System;
using System.Drawing;

// Moves active window to center of monitor, ignoring splits
// when run again (for same window) restores original position
// position is stored per window, so any number of windows may be centered and then moved back to original position
// set targetWidth to change window's width when centered (width is also restored when restoring position)
// ***
// TIP - set targetWidth to 1920 to emulate the width of a borderless FULL-HD window (very useful for ultra wides)
// ***
public static class DisplayFusionFunction
{

In this function i wold like to take active window, center and fit 1560, 0,2000,1392

WHen runn Center Window Ignoring Splits (run again to restore position) again then it goes back to previous size:

Is that an option?
• Attachment: 1.png [21,302 bytes]
1.png
1.png
Jun 17, 2024 (modified Jun 17, 2024)  • #5
Thomas Malloch (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.
• Attachment: Toggle Window to Center of Monitor.dfscript [4,120 bytes]
Jun 25, 2024  • #6
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(1)  Login to Vote(-)