Skip to content
Advertisement

Windows 7/10 – Make Application launch on a different display

I am porting a Linux application to windows , there are two executable’s which need to be launched on primary and secondary displays respectively.

In Linux its done through #!/bin/sh script,something like

display_start_dualhead LVDS 800 480 DVI 1024 768 24 export screen_main=$LVDS export screen_secondary=$DVI

how can this be done in Windows , launching exe1 in monitor 1 and exe 2 in monitor 2 ?

Advertisement

Answer

Process creation on windows is performed through the CreateProcess API which is passed a STARTUPINFO struct. This structure allows initial visibility and positional information to be passed to the launched process, with the intention that the process will use this when creating – and showing – its initial window.

I do not know of a built in command line tool that will populate the positional fields with the co-ordinates of each monitor, although the start command can be instructed to launch the window maximised or minimized.

Nonetheless it should be a trivial exercise to make an application that enumerates the monitors and fills these fields in. That said – having done this you might just find that the applications ignore these fields and position their windows directly.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement