Thank for your attached code again!
And according to EnumDisplayDevices function, It is necessary to clarify Display Adapter and Display Device.
You can refer to MADN: Getting Information on a Display Monitor sample or The Following Code(Multi-Byte Character Set) From Internet.
#include <windows.h>
#include <stdio.h>
#pragma comment(lib, "user32.lib")
void DumpDevice(const DISPLAY_DEVICE& dd, size_t nSpaceCount )
{
printf("%*sDevice Name: %s\n", nSpaceCount, "", dd.DeviceName );
printf("%*sDevice String: %s\n", nSpaceCount, "", dd.DeviceString );
printf("%*sState Flags: %x\n", nSpaceCount, "", dd.StateFlags );
printf("%*sDeviceID: %s\n", nSpaceCount, "", dd.DeviceID );
printf("%*sDeviceKey: ...%s\n\n", nSpaceCount, "", dd.DeviceKey+42 );
}
int main()
{
DISPLAY_DEVICE dd;
dd.cb = sizeof(DISPLAY_DEVICE);
DWORD deviceNum = 0;
while( EnumDisplayDevices(NULL, deviceNum, &dd, 0) ){
DumpDevice( dd, 0 );
DISPLAY_DEVICE newdd = {0};
newdd.cb = sizeof(DISPLAY_DEVICE);
DWORD monitorNum = 0;
while ( EnumDisplayDevices(dd.DeviceName, monitorNum, &newdd, 0))
{
DumpDevice( newdd, 4 );
monitorNum++;
}
puts("");
deviceNum++;
}
return 0;
}