I want to build a tiny application in Windows Vista. It should tell me, whether it (the application window itself) is displayed on the screen of a laptop or on an external screen. I'd like to use C++ in VisualStudio 08.
I seriously don't have a clue about programming for Windows, don't even know which way to approach this problem or which libraries to use. I would totally appreciate if someone of you guys/girls could help me out with a quick hint.
I am not sure you CAN tell which monitor is external.
The suggested GetMonitorInfo function will return a device (adapter) name like “\\.\DISPLAY1”. How would that help?
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio: FeinViewer - an integrated GDI objects viewer for Visual C++ Debugger, and more...
The Multiple Displays Monitor Functions was exactly what I was looking for, I hope..at least, it feels good. When I understood Vladimir right, you can't yet tell which monitor is external, since one could use the external monitor as primary display.
On the other hand, with making a WQL Query on the WmiMonitorConnectionParams (by stupidly altering about two lines of the example code as seen on http://msdn.microsoft.com/en-us/libr...=VS.85%29.aspx ), I can distinguish between an internal and an external display.
Well, now I'm not yet quite sure if I can map these both informations...or if i don't see the simple solution..
GetMonitorInfo gives me \\.\DISPLAY1
WMIMonitorID querying gives me sth. like DISPLAY\LGD0032\7&14066721&0&UID50331920_0
MonitorConnectionParams querying gives me 2147483648 for internal and sth. else for all external screens
that's pretty much it...i must have missed something, because this looks not too good for mapping, no clue how to proceed from there
...MonitorConnectionParams querying gives me 2147483648 for internal and sth. else for all external screens
That is actually a pretty interesting result: 2147483648 is 0x8000000 in hex. The highest bit set in the result usually indicate some special condition. Could you possibly use that?
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio: FeinViewer - an integrated GDI objects viewer for Visual C++ Debugger, and more...
Bookmarks