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
Jcee
205 discussion posts
https://1drv.ms/i/s!AijEU_gJRBQNgeg-BlXQpKwjFbvhZw
So I recently decided it would be cool to have 2 'wing' monitors next to my primary display
It consists of 2 1920x1080 monitors in portrait mode, and a single 4k TV in the center. (with the chosen monitors matching the pixel density of the primary display)

I was intending to game on this.. ofcourse, but Imagine my shock when Nvidias surround driver doesnt support portrait mode...

So on to display fusion :)

After several hours of problems (apparently trying to set the vertical position ABOVE the desktop work area is a big no-no, so I had to set the horizontal position to the left of the desktop work area instead)

I have this (attached below) which takes a Window, removes its boarder, and spans it across all my displays in a way that covers them Fully.

Please note that there is 240x1080 pixels missing from both the top left, and top right of your screen (which may be a big deal if your game has UI elements like health-bars at the top of the screen. so your results may vary

This is also hard-coded for my specific dimensions; if yours differ, this is the line that needs changed: (just ctrl+f to find it in the code)

BFS.Window.SetSizeAndLocation(windowHandle, -1080, 0, 6000, 2160);

Code

//##  Default (DisplayFusion)  ##//
using System;
using System.Data;
using System.Drawing;
using System.Management;
using System.Web;
using System.Windows.Forms;
using System.Xml;

//##  Default  ##//
using System.Runtime.InteropServices;

public static class DisplayFusionFunction{

/*#####################################################################################################################################################################################################################################################################################################~{*/
/*//////|   Run   |////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////g2*/
/*#####################################################################################################################################################################################################################################################################################################~}*/

  public static void Run(IntPtr windowHandle){
    if(verify_IgnoredWindow(windowHandle))
      {return;}

    if(! verify_IgnoredStyleWindow(windowHandle)){
    
       maximize_Window(windowHandle);
       remove_Border  (windowHandle);

    }
    else
      {BFS.Window.Maximize(windowHandle);}

  }

/*#####################################################################################################################################################################################################################################################################################################~{*/
/*//////|   Ignored Windows   |/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////g2*/
/*#####################################################################################################################################################################################################################################################################################################~}*/

  static string[] IGNORED_WINDOW_CLASSES = new string[]{
    //##  System  ##//
    "MultitaskingViewFrame",        //  Windows Alt-Tab & Win-Tab Screens
    "Progman",                      //  Windows Desktop
    "WorkerW",                      //  Windows Desktop
    "ApplicationFrameWindow",       //  Windows Settings
    "Windows.UI.Core.CoreWindow",   //  Windows System Menus
    "NotifyIconOverflowWindow",     //  Windows System Tray
    "TaskManagerWindow",            //  Windows Task Manager
    "Shell_TrayWnd",                //  Windows Taskbar
    "TaskListThumbnailWnd",         //  Windows Taskbar Thumbnail
    //##  Apps  ##//
    "ClassicShell.CMenuContainer",  //  ClassicStart
    "ExplorerBrowserOwner",         //  Fences
    "WMP Skin Host",                //  Windows Media Player Visualizer
    "CWmpControlCntr",              //  Windows Media Player Visualizer (Full-Screen)
  };

  static string[] IGNORED_WINDOW_STYLE_CLASSES = new string[]{
    //##  System  ##//
    "CabinetWClass",       //  Windows File Explorer
    //##  Apps  ##//
    "GomPlayer1.x",        //  GOM Player
    "Chrome_WidgetWin_1",  //  Google Chrome
    "ThunderRT6Main",      //  XYplorer
    "ThunderRT6FormDC",    //  XYplorer
  };

/*#####################################################################################################################################################################################################################################################################################################~{*/
/*//////|   Utils   |////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////g2*/
/*#####################################################################################################################################################################################################################################################################################################~}*/

  static bool verify_IgnoredWindow(IntPtr windowHandle){
    string windowClass = BFS.Window.GetClass(windowHandle);
    return (Array.IndexOf(IGNORED_WINDOW_CLASSES, windowClass) >= 0);
  }

  static bool verify_IgnoredStyleWindow(IntPtr windowHandle){
    string windowClass = BFS.Window.GetClass(windowHandle);
    return (Array.IndexOf(IGNORED_WINDOW_STYLE_CLASSES, windowClass) >= 0);
  }

  static BFS.WindowEnum.WindowStyle[] borderedWindowStyles = new BFS.WindowEnum.WindowStyle[]{
    BFS.WindowEnum.WindowStyle.WS_CAPTION,
    BFS.WindowEnum.WindowStyle.WS_SYSMENU,
    BFS.WindowEnum.WindowStyle.WS_THICKFRAME__SIZEBOX,
    BFS.WindowEnum.WindowStyle.WS_MINIMIZEBOX,
    BFS.WindowEnum.WindowStyle.WS_MAXIMIZEBOX,
  };

  static void remove_Border(IntPtr windowHandle){
    BFS.WindowEnum.WindowStyle style = BFS.Window.GetWindowStyle(windowHandle);
    foreach(BFS.WindowEnum.WindowStyle subStyle in borderedWindowStyles)
      {style &= ~subStyle;}
    BFS.Window.SetWindowStyle(style, windowHandle);
  }

  static void maximize_Window(IntPtr windowHandle){
    BFS.Window.SetSizeAndLocation(windowHandle, -1080, 0, 6000, 2160);
  }

  [DllImport("user32.dll")]
  static extern IntPtr SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int y, int cx, int cy, int wFlags);
  const short SWP_NOZORDER   = 0x4;
  const int   SWP_SHOWWINDOW = 0x0040;

}//  /DisplayFusionFunction
Dec 17, 2017 (modified Dec 23, 2017)  • #1
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)