Why does EnumDisplayDevices not output the monitor name?
The if statement prints out "Monitor Name: " but then blank where the name should be. So it appears the function does not fail.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
void EnumerateMonitorCapabilities()
{
int cDevices = 0;
int cMonitors = 0;
DISPLAY_DEVICE ddDevice;
ZeroMemory(&ddDevice, sizeof(DISPLAY_DEVICE));
ddDevice.cb = sizeof(DISPLAY_DEVICE);
while (EnumDisplayDevices(NULL, cDevices, &ddDevice, EDD_GET_DEVICE_INTERFACE_NAME))
{
if (ddDevice.StateFlags & DISPLAY_DEVICE_ACTIVE)
{
DISPLAY_DEVICE ddMonitor;
ZeroMemory(&ddMonitor, sizeof(DISPLAY_DEVICE));
if (EnumDisplayDevices(ddDevice.DeviceName, 0, &ddMonitor, 0))
{
std::cout << "\nMonitor Name: " << ddMonitor.DeviceName << std::endl;
}
cMonitors++;
}
cDevices++;
}
}
|
Topic archived. No new replies allowed.