I've searched long and far for a decent program to manage multiple monitors. UltraMon is alright, but I'm just not happy. So I thought I'd try my hand at making something. Below is my code so far. Its working well to get the current settings. I also was able to retrieve all functional settings with slight modifications. My real problem is this, I can get the name of the graphics card alright, but the best I can do for the monitor is Generic pnp Monitor. How can I get the make/model of the monitor? I'm also confused about how to use StateFlags to see what mode the monitor is in (primary, enabled, etc.) (see here). As you can see I outputted stateflags to the console. What is returned is a number of little significance to me. Unsure how to compare it to the constants described on the msdn page. I appreciate any help you can offer. I'm afraid this is the most difficult programming task I've ever undertaken, but I am learning. So far I'm only at the stage of gathering info about connected monitors. You may here more from me as I progress.
code
#include <windows.h>
#include <iostream.h>
int main(){
DISPLAY_DEVICE lpDisplayDevice;
lpDisplayDevice.cb = sizeof(lpDisplayDevice);
DWORD iDevNum = 0;
while (EnumDisplayDevices(0, iDevNum, &lpDisplayDevice, 0)){
cout<<lpDisplayDevice.DeviceString<<endl;
cout<<lpDisplayDevice.StateFlags<<endl;
DEVMODE lpDevMode;
lpDevMode.dmSize = sizeof(lpDevMode);
if (EnumDisplaySettings(lpDisplayDevice.DeviceName, -1, &lpDevMode)){
cout<<lpDevMode.dmDisplayFrequency<<endl;
cout<<lpDevMode.dmPelsWidth<<endl;
cout<<lpDevMode.dmPelsHeight<<endl
}
ZeroMemory(&lpDisplayDevice, sizeof(lpDisplayDevice));
lpDisplayDevice.cb = sizeof(lpDisplayDevice);
iDevNum++;
}
}
code output (for me)
NVIDIA GeForce GTX 260 134217733 59 1680 1050 NVIDIA GeForce GTX 260 134217728 RDPDD Chained DD 8 RDP Encoder Mirror Driver 2097160 RDP Reflector Display Driver 2097160
This post has been edited by spiderdan: 10 August 2010 - 03:48 PM

New Topic/Question
Reply




MultiQuote




|