I'm having a bit of trouble retrieving the name of a monitor with winapi. According to other entries on stackoverflow, the correct way to get the name of a monitor is this:
EnumDisplayDevices(nullptr, 0, &oDisplayDevice, 0);
char lpszDeviceName[32];
memcpy(lpszDeviceName, oDisplayDevice.DeviceName, 32);
EnumDisplayDevices(lpszDeviceName, 0, &oDisplayDevice, 0);
char lpszMonitorName[128];
memcpy(lpszMonitorName, oDisplayDevice.DeviceString, 128);
However, EnumDisplayDevices
returns FALSE
the second time around. The first time around, DeviceName
is \\DISPLAY1
and DeviceString
is the GPU vendor. Using the MONITORINFOEX
struct gives me the same value as DeviceName
.
To be clear I'm looking for something like "Samsung blah blah," or what appears in the control panel on the screen resolution page.