I'm writing a small tool that opens programs on specific screens, so that I can set our monitoring screens (1 machine has 2 screens) to reboot overnight and have it restore the monitoring webpages on boot to the correct screens. I had in mind to accomplish this by using .NET's System.Diagnostics.Process class.
I already saw it's possible to open a process and THEN move it somewhere using P/Invokes ( Open notepad to specific location on the screen, and to desired size? ), however I want to set the target screen BEFORE the application opens, so that for example Chrome in Kiosk mode starts properly with this setup.
Does anyone know how to do this?
We created a similar solution not to long ago using the user32.dll's
SetWindowPos
. While it does not open the program on the desired window, it takes a couple of milliseconds to do so, so not really an issue for your requirement!You can have a look at the following gist:
https://gist.github.com/reinhardholl/013a7c3fa319beeaf534#file-display-cs
Pay specific attention to the
Display
class:Let me know if you require some more help!