1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
#include "SingleMonitorInfo.h"
SingleMonitorInfo::SingleMonitorInfo()
{
SingleMonitorInfo::dMaxPercentDifference = static_cast<double>(1);
SingleMonitorInfo::intCheckTaskbar = static_cast<int>(1);
SingleMonitorInfo::rcMonitorArea = RECT{ 0, 0, 0, 0 };
SingleMonitorInfo::rcWorkArea = RECT{ 0, 0, 0, 0 };
SingleMonitorInfo::dwStatusFlags = DWORD(0x00000000);
SingleMonitorInfo::dwCapabilitiesFlags = DWORD(0x00000000);
wcscpy_s(SingleMonitorInfo::szDeviceName, 1, TEXT('\0'));
wcscpy_s(SingleMonitorInfo::szMonitorName, 1, TEXT('\0'));
wcscpy_s(SingleMonitorInfo::szMonitorDescription, 1, TEXT('\0'));
lpPixelArray = NULL;
}
SingleMonitorInfo::SingleMonitorInfo(MONITORINFOEX* lpMONITORINFOEX)
{
SingleMonitorInfo::dMaxPercentDifference = static_cast<double>(1);
SingleMonitorInfo::intCheckTaskbar = static_cast<int>(1);
SingleMonitorInfo::rcMonitorArea = lpMONITORINFOEX->rcMonitor;
SingleMonitorInfo::rcWorkArea = lpMONITORINFOEX->rcWork;
SingleMonitorInfo::dwStatusFlags = lpMONITORINFOEX->dwFlags;
SingleMonitorInfo::dwCapabilitiesFlags = DWORD(0x00000000);
wcscpy_s(SingleMonitorInfo::szDeviceName, 33, lpMONITORINFOEX->szDevice);
SingleMonitorInfo::setStringMonitorNameAndDescription(lpMONITORINFOEX->szDevice);
lpPixelArray = NULL;
}
SingleMonitorInfo::~SingleMonitorInfo()
{
SingleMonitorInfo::freePixelArray();
}
// PRIVATE
int SingleMonitorInfo::setStringMonitorNameAndDescription(TCHAR* lpDeviceName)
{
DISPLAY_DEVICE dd;
dd.cb = sizeof(DISPLAY_DEVICE);
EnumDisplayDevices(lpDeviceName, 0, &dd, NULL);
wcscpy_s(SingleMonitorInfo::szMonitorName, 33, dd.DeviceName);
wcscpy_s(SingleMonitorInfo::szMonitorDescription, 129, dd.DeviceString);
return 0;
}
...
|