Note that there are some explanatory texts on larger screens.

plurals
  1. POConsole app to launch multiple instances of IE maximized on multiple monitors
    text
    copied!<p>I would like to create a C# console application to launch multiple instances of IE maximized on multiple monitors.</p> <p>Update: Here is what I have tried so far. When I launch the second IE instance, it does not open on the second screen. I think it has something to do with the MainWindowHandle since IE may have only one main window handle that it shares with multiple windows. The last line of code actually throws an InvalidOperationException. This code works for launching notepad, but not for IE.</p> <pre><code>using System; using System.Diagnostics; using System.Drawing; using System.Runtime.InteropServices; using System.Windows.Forms; namespace TestLauncher { class Launcher2 { [DllImport("user32.dll")] private extern static bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, int uFlags); const int SWP_SHOWWINDOW = 0x0040; static readonly IntPtr HWND_TOP = IntPtr.Zero; public void Launch() { Process p1 = new Process(); p1.StartInfo.FileName = "iexplore.exe"; p1.StartInfo.Arguments = "microsoft.com"; p1.Start(); p1.WaitForInputIdle(2000); System.Threading.Thread.Sleep(2000); Rectangle monitor = Screen.AllScreens[0].WorkingArea; SetWindowPos(p1.MainWindowHandle, HWND_TOP, monitor.Left, monitor.Top, monitor.Width, monitor.Height, SWP_SHOWWINDOW); Process p2 = new Process(); p2.StartInfo.FileName = "iexplore.exe"; p2.StartInfo.Arguments = "google.com"; p2.Start(); p2.WaitForInputIdle(2000); System.Threading.Thread.Sleep(2000); Rectangle monitor2 = Screen.AllScreens[1].WorkingArea; SetWindowPos(p2.MainWindowHandle, HWND_TOP, monitor2.Left, monitor2.Top, monitor2.Width, monitor2.Height, SWP_SHOWWINDOW); } } } </code></pre> <p>If possible, I am seeking a solution that is flexible enough to launch other applications besides IE also.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload