Question

Is there a way for me to have my debug program from VS 2012 run on the secondary monitor. As of now, whenever a run a program from VS 2012, regardless of which monitor VS is on, the debug program always shows up in my primary monitor.

Was it helpful?

Solution

It is entirely up to your own code to decide where it places the window, the debugger has no way to affect it. So just write the code to get it on the second monitor. You left no bread-crumbs at all what language or GUI class library you use, the native CreateWindowEx() call takes an x and y argument for the desired position.

Keep in mind that your user will typically also find it useful that you re-open the window in the location where it was last used. So this isn't just beneficial to you. Simply record the window position when the user closes it in persistent storage, like a registry key or a file. And reload it when you create it again.

OTHER TIPS

I believe this is more of a function of Windows than visual studio. The debugger will just start the program, but the window manager defines it's initial position. If I recall correctly, default behavior is to open new windows on the same display as the mouse cursor if the program doesn't define it's own position.

First be sure that you aren't setting the default position somewhere in your program, and then I would say try moving your mouse cursor to the screen that you want before debugging (use the keyboard shortcut).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top