Center the Game Controllers window at ANY resolution: Single, Triple and Ultrawide Monitors

BP

1000RPM
Original poster
Premium
Nov 1, 2016
1,390
1,468
Triple and UltraWide monitor racers rejoice! :roflmao:

Ever get annoyed that the Game Controller window keeps opening near the top left corner of your screen(s) with no way to save it to the center? I certainly did, so after about a day of learning some basic coding, lots of trial and error and borrowing a few lines from public forums, I finally figured out how to create a single executable that will call the Game Controller window to the center of the monitor, no matter the resolution or how many monitors you have in Nvidia Surround/AMD Eyefinity. Tested at all available resolutions I have access to, from single monitor 800 x 600 to triple monitor 5856 x 1080.

It's totally safe (the only thing it checks is your current desktop resolution) and just uses a cmd program named cmdow (located here) to move the window using simple math. I initially planned to upload just the code from the batch file, but it's much simpler to just wrap everything up in one file, plus you can just pin this to the taskbar/start menu (can't do that with batch files). Regardless, here's the batch file code for full transparency (I know people are wary of .EXE files):

Code:
@ECHO OFF
REM BFCPEOPTIONSTART
REM Advanced BAT to EXE Converter www.BatToExeConverter.com
REM BFCPEEXE=C:\Users\BJP\Desktop\GC Center Screen.exe
REM BFCPEICON=M:\7Stacks Shortcuts\bullseye_blue_zIV_icon.ico
REM BFCPEICONINDEX=2
REM BFCPEEMBEDDISPLAY=0
REM BFCPEEMBEDDELETE=1
REM BFCPEADMINEXE=0
REM BFCPEINVISEXE=0
REM BFCPEVERINCLUDE=1
REM BFCPEVERVERSION=1.0.0.0
REM BFCPEVERPRODUCT=Games Controller Center Screen
REM BFCPEVERDESC=Centers the Game Controller Window
REM BFCPEVERCOMPANY=johndough247
REM BFCPEVERCOPYRIGHT=johndough247
REM BFCPEEMBED=C:\cmdow.exe
REM BFCPEOPTIONEND
@ECHO ON
@ECHO OFF

setlocal
for /f "tokens=4,5 delims=. " %%a in ('ver') do set "version=%%a%%b"


if version lss 62 (
    ::set "wmic_query=wmic desktopmonitor get screenheight, screenwidth /format:value"
    for /f "tokens=* delims=" %%@ in ('wmic desktopmonitor get screenwidth /format:value') do (
        for /f "tokens=2 delims==" %%# in ("%%@") do set "x=%%#"
    )
    for /f "tokens=* delims=" %%@ in ('wmic desktopmonitor get screenheight /format:value') do (
        for /f "tokens=2 delims==" %%# in ("%%@") do set "y=%%#"
    )

) else (
    ::wmic path Win32_VideoController get VideoModeDescription,CurrentVerticalResolution,CurrentHorizontalResolution /format:value
    for /f "tokens=* delims=" %%@ in ('wmic path Win32_VideoController get CurrentHorizontalResolution  /format:value') do (
        for /f "tokens=2 delims==" %%# in ("%%@") do set "x=%%#"
    )
    for /f "tokens=* delims=" %%@ in ('wmic path Win32_VideoController get CurrentVerticalResolution /format:value') do (
        for /f "tokens=2 delims==" %%# in ("%%@") do set "y=%%#"
    )

)

set /A "W=%x%/2-195"
set /A "H=%y%/2-250"


CD /D C:\Windows\System32
START rundll32.exe Shell32.dll,Control_RunDLL joy.cpl
CD %MYFILES%
START %MYFILES%\cmdow "Game Controllers" /mov %W% %H%

endlocal
I called it the "Game Controller Center Screen". Fancy name, I know. Just extract the .exe anywhere on your PC and create a shortcut on your desktop, start menu or taskbar.

Enjoy!
https://mega.nz/#!xl8mSKoA!WhV9iscmYWq35jQNSP5wwJrQ6kY0EqzMR-pWdaWziXs
 

BP

1000RPM
Original poster
Premium
Nov 1, 2016
1,390
1,468
Please note: your virus scanner may give you a false-positive when you download this file...again, it's totally harmless; only the code in the OP is what's in the executable. I ran it through Virustotal and most of the reports have to do with the cmdow program in the file.