Open program on the 2nd monitor

792 views Asked by At

I used SetWindowPos to move a window into the 2nd monitor.

Here are my steps:

ProcessStartInfo startInfo = new ProcessStartInfo(file.FullName);
startInfo.WindowStyle = ProcessWindowStyle.Maximized;
Process p = Process.Start(startInfo);

Rectangle screen = Screen.AllScreens[1].WorkingArea;
SetWindowPos(p.MainWindowHandle, IntPtr.Zero,
                screen.Left, screen.Top, screen.Width, screen.Height, 0);

(file is a PlanarView (.pvs) app)

It has been moved into the 2nd monitor successfully. But after minimized and maximized, the window turn back the primary monitor.

0

There are 0 answers