Merge branch 'master' of ssh://git.devwiki.net:222/DevWiki/WinDevice

This commit is contained in:
DevWiki 2023-09-20 10:11:00 +08:00
commit 6afc46f8fa

View File

@ -264,6 +264,29 @@ int SysInfoUtil::GetInfoByEnumDisplayDevices()
return 0; return 0;
} }
void SysInfoUtil::GetInfoByEnumDisplayDevicesA()
{
DISPLAY_DEVICEA dd;
DEVMODEA dm;
for (int i = 0;; i++) {
ZeroMemory(&dd, sizeof(dd));
dd.cb = sizeof(dd);
BOOL ret = (EnumDisplayDevicesA(NULL, i, &dd, 0));
if (ret == FALSE)
break;
ZeroMemory(&dm, sizeof(dm));
dm.dmSize = sizeof(dm);
if (EnumDisplaySettingsA(dd.DeviceName, ENUM_CURRENT_SETTINGS, &dm)) {
std::cout << "Device #" << i << " Information:" << std::endl;
std::cout << "Device Name: " << dd.DeviceName << std::endl;
std::cout << "Device String: " << dd.DeviceString << std::endl;
std::cout << "State: " << (dd.StateFlags & DISPLAY_DEVICE_ACTIVE ? "Active" : "Inactive") << std::endl;
std::cout << "Device ID: " << dd.DeviceID << std::endl;
std::cout << "Device Key: " << dd.DeviceKey << std::endl;
std::cout << std::endl;
}
}
}
void SysInfoUtil::GetInfoByEnumDisplayMonitors() void SysInfoUtil::GetInfoByEnumDisplayMonitors()
{ {
wcout << "=====GetInfoByEnumDisplayMonitors start=====" << endl; wcout << "=====GetInfoByEnumDisplayMonitors start=====" << endl;