TransWikia.com

How to prevent app from opening on a monitor that isn't in use(powered down)?

Super User Asked by user153343 on September 8, 2020

I have an app(fine metronome) that always wants to open on a monitor(3/3) that isn’t in use(I keep it powered down most of the time).

Also, the standard move methods don’t work(alt + right click or windows + arrows).

Anyone have a nice way to force the app to use the only monitor that is on or a utility that will move an app to the monitors that are on?

2 Answers

Copied these from other answers around the web and compiled them here for your easy of access (added things to ease readability):

  1. Open the application.
  2. Re-size the window so that it is not maximized or minimized.
  3. Move the window to the monitor you want it to open on by default.
  4. Close the application. Do not re-size prior to closing.
  5. Open the application. It should open on the monitor you just moved it to and closed it on.
  6. Maximize the window.

The reason why this works is two fold.

Correctly written Windows apps that want to save their location from run to run will save the results of GetWindowPlacement() before shutting down, then use SetWindowPlacement() on startup to restore their position.

Frequently, apps will store the results of GetWindowPlacement() in the registry as a REG_BINARY for easy use.

The WINDOWPLACEMENTroute has many advantages over other methods:

Handles the case where the screen resolution changed since the last run: SetWindowPlacement() will automatically ensure that the window is not entirely offscreen Saves the state (minimized/maximized) but also saves the restored (normal) size and position Handles desktop metrics correctly, compensating for the taskbar position, etc. (i.e. uses "workspace coordinates" instead of "screen coordinates" -- techniques that rely on saving screen coordinates may suffer from the "walking windows" problem where a window will always appear a little lower each time if the user has a toolbar at the top of the screen). Finally, programs that handle window restoration properly will take into account the nCmdShow parameter passed in from the shell. This parameter is set in the shortcut that launches the application (Normal, Minimized, Maximize):

if(nCmdShow != SW_SHOWNORMAL)
    placement.showCmd = nCmdShow; //allow shortcut to override

For non-Win32 applications, it's important to be sure that the method you're using to save/restore window position eventually uses the same underlying call, otherwise (like Java Swing's setBounds()/getBounds() problem) you'll end up writing a lot of extra code to re-implement functionality that's already there in the WINDOWPLACEMENT functions.

Alternatively you can use other applications such as: http://realtimesoft.com/ultramon/

Or simply shifting the application from monitor to monitor using:the Shift + Win + [left,right] arrow keys shortcut. You can move the currently active window to another monitor with it.

I hope these answers are of some use to you.

References: How to make applications open on the correct monitor when using multiple monitors? https://stackoverflow.com/questions/52755/what-determines-the-monitor-my-app-runs-on http://www.tenforums.com/general-support/14348-forcing-program-open-second-monitor-rather-than-main.html

Correct answer by bcm27 on September 8, 2020

The shortcut Win+Shift+Left arrow or Win+Shift+Right arrow will move the active window to the left or right monitor (actually to the next or previous monitor).


Another possibility is to use the free AutoHotkey. It treats the desktop as one space with all monitors concatenated in order. This lets you easily move windows between monitors.

The following example script will trigger on the F9 key to move a window partially specified by title to left 1080 pixels, presuming that the powered-off monitor is 1080 pixels wide, so that will place it on the previous monitor.

SetTitleMatchMode, 2
F9::WinMove, RSA, , -1080

After installing AutoHotKey, put the above text in a .ahk file and double-click it to test. You may stop the script by right-click on the green H icon in the traybar and choosing Exit. To have it run on login, place it in the Startup group at C:UsersUSER-NAMEAppDataRoamingMicrosoftWindowsStart MenuProgramsStartup.

Useful AutoHotkey documentation:

Answered by harrymc on September 8, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP