I work on a WPF Application. I have two monitors connected to the same machine. I launch the application. How can I detect on which of the two screens the application is launched via code (C#)? Thanks!
Asked
Active
Viewed 335 times
1 Answers
0
Have you tried the Screen
class? To get the current screen use the static method FromControl
and pass your control as an argument. Then you can check the device name or Primary
property to detect if you are on the primary monitor.

Foggzie
- 9,691
- 1
- 31
- 48

Radin Gospodinov
- 2,313
- 13
- 14
-
You can call that after you application has finished launching. – Radin Gospodinov May 11 '15 at 14:50
-
I read about it and tried to make it work, but I don't have a reference to any control from the location in code where I want to perform the mentioned check (a static class). I also read about GetWindowThreadProcessId, but not sure of how to use it. – Cod Fish May 11 '15 at 14:54