0

I want to move a Window (HWND) in a second monitor. The thing is that I tried many things like double the resolution or putting negative values and it never was able to put the window on my second monitor.

Any clue of how to do that in C/C++/c#

gaijintendo
  • 423
  • 2
  • 14
SBSTP
  • 3,479
  • 6
  • 30
  • 41

2 Answers2

3

Screen and the Form.StartPosition should get you there.

See the first answer to this post (for C#/WinForms solution): How do I ensure a form displays on the "additional" monitor in a dual monitor scenario?

Community
  • 1
  • 1
holtavolt
  • 4,378
  • 1
  • 26
  • 40
0

The desktop layout is user-configurable, a second monitor can be to the left, to the right, above, below, or positioned weirdly compared to the primary.

The GetMonitorInfo function will help you find out where the second monitor is, in virtual screen coordinates. As @holtavolt mentioned, the .NET Screen class is a convenient wrapper.

Community
  • 1
  • 1
Ben Voigt
  • 277,958
  • 43
  • 419
  • 720