Minor tweaks.

This commit is contained in:
spx 2011-12-09 19:49:06 +00:00
parent 13b3241307
commit 3bebd7002a
10 changed files with 94 additions and 80 deletions

View File

@ -1308,7 +1308,7 @@ void CConfigParser::SetValue(const std::wstring& strSection, const std::wstring&
std::wstring strTmp; std::wstring strTmp;
strTmp.reserve(strSection.size() + 1 + strKey.size()); strTmp.reserve(strSection.size() + 1 + strKey.size());
strTmp += strSection; strTmp = strSection;
strTmp += L'~'; strTmp += L'~';
strTmp += strKey; strTmp += strKey;
@ -1327,7 +1327,7 @@ void CConfigParser::DeleteValue(const std::wstring& strSection, const std::wstri
{ {
std::wstring strTmp; std::wstring strTmp;
strTmp.reserve(strSection.size() + 1 + strKey.size()); strTmp.reserve(strSection.size() + 1 + strKey.size());
strTmp += strSection; strTmp = strSection;
strTmp += L'~'; strTmp += L'~';
strTmp += strKey; strTmp += strKey;
@ -1351,7 +1351,7 @@ const std::wstring& CConfigParser::GetValue(const std::wstring& strSection, cons
{ {
std::wstring strTmp; std::wstring strTmp;
strTmp.reserve(strSection.size() + 1 + strKey.size()); strTmp.reserve(strSection.size() + 1 + strKey.size());
strTmp += strSection; strTmp = strSection;
strTmp += L'~'; strTmp += L'~';
strTmp += strKey; strTmp += strKey;

View File

@ -306,12 +306,12 @@ BOOL LogInternal(int nLevel, ULONGLONG elapsed, LPCTSTR pszMessage)
{ {
// Add timestamp // Add timestamp
WCHAR buffer[128]; WCHAR buffer[128];
_snwprintf_s(buffer, _TRUNCATE, L"%02llu:%02llu:%02llu.%03llu", elapsed / (1000 * 60 * 60), (elapsed / (1000 * 60)) % 60, (elapsed / 1000) % 60, elapsed % 1000); size_t len = _snwprintf_s(buffer, _TRUNCATE, L"%02llu:%02llu:%02llu.%03llu", elapsed / (1000 * 60 * 60), (elapsed / (1000 * 60)) % 60, (elapsed / 1000) % 60, elapsed % 1000);
Rainmeter->AddAboutLogInfo(nLevel, buffer, pszMessage); Rainmeter->AddAboutLogInfo(nLevel, buffer, pszMessage);
std::wstring message(1, L'('); std::wstring message(1, L'(');
message += buffer; message.append(buffer, len);
message += L") "; message += L") ";
message += pszMessage; message += pszMessage;

View File

@ -247,7 +247,7 @@ const WCHAR* CMeasure::CheckSubstitute(const WCHAR* buffer)
std::string utf8str = ConvertToUTF8(buffer); std::string utf8str = ConvertToUTF8(buffer);
int* ovector = new int[OVECCOUNT]; int* ovector = new int[OVECCOUNT];
for (size_t i = 0, isize = m_Substitute.size() ; i < isize ; i += 2) for (size_t i = 0, isize = m_Substitute.size(); i < isize ; i += 2)
{ {
pcre* re; pcre* re;
const char* error; const char* error;
@ -298,9 +298,8 @@ const WCHAR* CMeasure::CheckSubstitute(const WCHAR* buffer)
size_t in_length = ovector[2 * j + 1] - ovector[2 * j]; size_t in_length = ovector[2 * j + 1] - ovector[2 * j];
char tmpName[64]; char tmpName[64];
_snprintf_s(tmpName, _TRUNCATE, "\\%i", j);
size_t cut_length = strlen(tmpName); size_t cut_length = _snprintf_s(tmpName, _TRUNCATE, "\\%i", j);;
size_t start = 0, pos; size_t start = 0, pos;
do do
{ {

View File

@ -624,16 +624,31 @@ void CMeasureNet::ReadStats(const WCHAR* iniFile, std::wstring& statsDate)
} }
} }
/*
** AppendStatsValue
**
** Appends "key=value\0" to given string.
**
*/
inline void AppendStatsValue(std::wstring& data, const WCHAR* key, size_t key_len, const WCHAR* value, size_t value_len)
{
data.append(key, key_len);
data += L'=';
data.append(value, value_len);
data += L'\0';
}
/* /*
** WriteStats ** WriteStats
** **
** Writes statistics. ** Writes statistics.
** **
*/ */
void CMeasureNet::WriteStats(const WCHAR* iniFile, const WCHAR* statsDate) void CMeasureNet::WriteStats(const WCHAR* iniFile, const std::wstring& statsDate)
{ {
WCHAR buffer[32]; WCHAR buffer[64];
WCHAR buffer2[64]; WCHAR buffer2[32];
size_t len, len2;
size_t statsSize = c_StatValues.size() / 2; size_t statsSize = c_StatValues.size() / 2;
@ -642,11 +657,11 @@ void CMeasureNet::WriteStats(const WCHAR* iniFile, const WCHAR* statsDate)
data.reserve((64 * 2) + 128 * statsSize); data.reserve((64 * 2) + 128 * statsSize);
// Add date // Add date
AppendStatsValue(data, L"Since", statsDate); AppendStatsValue(data, L"Since", 5, statsDate.c_str(), statsDate.size());
// Add stats count // Add stats count
_itow_s((int)statsSize, buffer, 10); len = _snwprintf_s(buffer, _TRUNCATE, L"%i", (int)statsSize);
AppendStatsValue(data, L"NetStatsCount", buffer); AppendStatsValue(data, L"NetStatsCount", 13, buffer, len);
// Add stats // Add stats
for (size_t i = 0; i < statsSize; ++i) for (size_t i = 0; i < statsSize; ++i)
@ -655,43 +670,29 @@ void CMeasureNet::WriteStats(const WCHAR* iniFile, const WCHAR* statsDate)
value.QuadPart = c_StatValues[i * 2]; value.QuadPart = c_StatValues[i * 2];
_snwprintf_s(buffer2, _TRUNCATE, L"NetStatsInHigh%i", (int)i + 1); len = _snwprintf_s(buffer, _TRUNCATE, L"NetStatsInHigh%i", (int)i + 1);
_snwprintf_s(buffer, _TRUNCATE, L"%u", value.HighPart); len2 = _snwprintf_s(buffer2, _TRUNCATE, L"%u", value.HighPart);
AppendStatsValue(data, buffer2, buffer); AppendStatsValue(data, buffer, len, buffer2, len2);
_snwprintf_s(buffer2, _TRUNCATE, L"NetStatsInLow%i", (int)i + 1); len = _snwprintf_s(buffer, _TRUNCATE, L"NetStatsInLow%i", (int)i + 1);
_snwprintf_s(buffer, _TRUNCATE, L"%u", value.LowPart); len2 = _snwprintf_s(buffer2, _TRUNCATE, L"%u", value.LowPart);
AppendStatsValue(data, buffer2, buffer); AppendStatsValue(data, buffer, len, buffer2, len2);
value.QuadPart = c_StatValues[i * 2 + 1]; value.QuadPart = c_StatValues[i * 2 + 1];
_snwprintf_s(buffer2, _TRUNCATE, L"NetStatsOutHigh%i", (int)i + 1); len = _snwprintf_s(buffer, _TRUNCATE, L"NetStatsOutHigh%i", (int)i + 1);
_snwprintf_s(buffer, _TRUNCATE, L"%u", value.HighPart); len2 = _snwprintf_s(buffer2, _TRUNCATE, L"%u", value.HighPart);
AppendStatsValue(data, buffer2, buffer); AppendStatsValue(data, buffer, len, buffer2, len2);
_snwprintf_s(buffer2, _TRUNCATE, L"NetStatsOutLow%i", (int)i + 1); len = _snwprintf_s(buffer, _TRUNCATE, L"NetStatsOutLow%i", (int)i + 1);
_snwprintf_s(buffer, _TRUNCATE, L"%u", value.LowPart); len2 = _snwprintf_s(buffer2, _TRUNCATE, L"%u", value.LowPart);
AppendStatsValue(data, buffer2, buffer); AppendStatsValue(data, buffer, len, buffer2, len2);
} }
// Write statistics // Write statistics
WritePrivateProfileSection(L"Statistics", data.c_str(), iniFile); WritePrivateProfileSection(L"Statistics", data.c_str(), iniFile);
} }
/*
** AppendStatsValue
**
** Appends "key=value\0" to given string.
**
*/
void CMeasureNet::AppendStatsValue(std::wstring& data, const WCHAR* key, const WCHAR* value)
{
data += key;
data += L'=';
data += value;
data += L'\0';
}
/* /*
** InitializeNewApi ** InitializeNewApi
** **

View File

@ -46,7 +46,7 @@ public:
static void UpdateStats(); static void UpdateStats();
static void ResetStats(); static void ResetStats();
static void ReadStats(const WCHAR* iniFile, std::wstring& statsDate); static void ReadStats(const WCHAR* iniFile, std::wstring& statsDate);
static void WriteStats(const WCHAR* iniFile, const WCHAR* statsDate); static void WriteStats(const WCHAR* iniFile, const std::wstring& statsDate);
static void InitializeNewApi(); static void InitializeNewApi();
static void FinalizeNewApi(); static void FinalizeNewApi();
@ -56,8 +56,6 @@ protected:
ULONG64 GetNetOctets(NET net); ULONG64 GetNetOctets(NET net);
ULONG64 GetNetStatsValue(NET net); ULONG64 GetNetStatsValue(NET net);
static void AppendStatsValue(std::wstring& data, const WCHAR* key, const WCHAR* value);
double m_CurrentTraffic; double m_CurrentTraffic;
double m_TrafficValue; double m_TrafficValue;
UINT m_Interface; UINT m_Interface;

View File

@ -723,8 +723,9 @@ void CMeterString::FreeFontCache(PrivateFontCollection* collection)
if (collection) if (collection)
{ {
WCHAR buffer[32]; WCHAR buffer[32];
_snwprintf_s(buffer, _TRUNCATE, L"<%p>", collection); size_t len = _snwprintf_s(buffer, _TRUNCATE, L"<%p>", collection);
prefix = buffer;
prefix.assign(buffer, len);
StringToLower(prefix); StringToLower(prefix);
} }
@ -774,8 +775,12 @@ void CMeterString::FreeFontCache(PrivateFontCollection* collection)
std::wstring CMeterString::FontFaceToString(const std::wstring& fontFace, PrivateFontCollection* collection) std::wstring CMeterString::FontFaceToString(const std::wstring& fontFace, PrivateFontCollection* collection)
{ {
WCHAR buffer[32]; WCHAR buffer[32];
_snwprintf_s(buffer, _TRUNCATE, L"<%p>", collection); size_t len = _snwprintf_s(buffer, _TRUNCATE, L"<%p>", collection);
std::wstring strTmp = buffer + fontFace;
std::wstring strTmp;
strTmp.reserve(len + fontFace.size());
strTmp.assign(buffer, len);
strTmp += fontFace;
StringToLower(strTmp); StringToLower(strTmp);
return strTmp; return strTmp;
} }
@ -789,8 +794,9 @@ std::wstring CMeterString::FontFaceToString(const std::wstring& fontFace, Privat
std::wstring CMeterString::FontPropertiesToString(REAL size, FontStyle style) std::wstring CMeterString::FontPropertiesToString(REAL size, FontStyle style)
{ {
WCHAR buffer[64]; WCHAR buffer[64];
_snwprintf_s(buffer, _TRUNCATE, L"%.1f-%i", size, (int)style); size_t len = _snwprintf_s(buffer, _TRUNCATE, L"%.1f-%i", size, (int)style);
return buffer;
return std::wstring(buffer, len);
} }
/* /*

View File

@ -2478,8 +2478,8 @@ void CRainmeter::UpdateDesktopWorkArea(bool reset)
if (i != 0) if (i != 0)
{ {
WCHAR buffer[64]; WCHAR buffer[64];
_snwprintf_s(buffer, _TRUNCATE, L"@%i", i); size_t len = _snwprintf_s(buffer, _TRUNCATE, L"@%i", i);
format += buffer; format.append(buffer, len);
} }
format += L": L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)"; format += L": L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)";
if (!result) if (!result)
@ -2550,7 +2550,7 @@ void CRainmeter::WriteStats(bool bForce)
// Only Net measure has stats at the moment // Only Net measure has stats at the moment
const WCHAR* statsFile = m_StatsFile.c_str(); const WCHAR* statsFile = m_StatsFile.c_str();
CMeasureNet::WriteStats(statsFile, m_StatsDate.c_str()); CMeasureNet::WriteStats(statsFile, m_StatsDate);
WritePrivateProfileString(NULL, NULL, NULL, statsFile); WritePrivateProfileString(NULL, NULL, NULL, statsFile);
} }
@ -2987,13 +2987,13 @@ void CRainmeter::CreateMonitorMenu(HMENU monitorMenu, CMeterWindow* meterWindow)
for (int i = 0, isize = (int)monitors.size(); i < isize; ++i) for (int i = 0, isize = (int)monitors.size(); i < isize; ++i)
{ {
WCHAR buffer[64]; WCHAR buffer[64];
_snwprintf_s(buffer, _TRUNCATE, L"@%i: ", i + 1); size_t len = _snwprintf_s(buffer, _TRUNCATE, L"@%i: ", i + 1);
std::wstring item = buffer;
size_t len = wcslen(monitors[i].monitorName); std::wstring item(buffer, len);
if (len > 32)
if (monitors[i].monitorName.size() > 32)
{ {
item.append(monitors[i].monitorName, 32); item.append(monitors[i].monitorName, 0, 32);
item += L"..."; item += L"...";
} }
else else
@ -3212,7 +3212,7 @@ void CRainmeter::ExpandEnvironmentVariables(std::wstring& strPath)
} }
if (ret <= bufSize) // Fits in the buffer if (ret <= bufSize) // Fits in the buffer
{ {
strPath = buffer; strPath.assign(buffer, ret - 1);
break; break;
} }

View File

@ -191,7 +191,7 @@ BOOL CALLBACK MyInfoEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonit
{ {
for (size_t i = 0, isize = m->monitors.size(); i < isize; ++i) for (size_t i = 0, isize = m->monitors.size(); i < isize; ++i)
{ {
if (m->monitors[i].handle == NULL && _wcsnicmp(info.szDevice, m->monitors[i].deviceName, 32) == 0) if (m->monitors[i].handle == NULL && _wcsicmp(info.szDevice, m->monitors[i].deviceName.c_str()) == 0)
{ {
m->monitors[i].handle = hMonitor; m->monitors[i].handle = hMonitor;
m->monitors[i].screen = *lprcMonitor; m->monitors[i].screen = *lprcMonitor;
@ -202,14 +202,14 @@ BOOL CALLBACK MyInfoEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonit
} }
else // use only EnumDisplayMonitors else // use only EnumDisplayMonitors
{ {
MONITOR_INFO monitor = {0}; MONITOR_INFO monitor;
monitor.active = true; monitor.active = true;
monitor.handle = hMonitor; monitor.handle = hMonitor;
monitor.screen = *lprcMonitor; monitor.screen = *lprcMonitor;
monitor.work = info.rcWork; monitor.work = info.rcWork;
wcsncpy_s(monitor.deviceName, info.szDevice, _TRUNCATE); // E.g. "\\.\DISPLAY1" monitor.deviceName = info.szDevice; // E.g. "\\.\DISPLAY1"
// Get the monitor name (E.g. "Generic Non-PnP Monitor") // Get the monitor name (E.g. "Generic Non-PnP Monitor")
DISPLAY_DEVICE ddm = {sizeof(DISPLAY_DEVICE)}; DISPLAY_DEVICE ddm = {sizeof(DISPLAY_DEVICE)};
@ -218,7 +218,7 @@ BOOL CALLBACK MyInfoEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonit
{ {
if (ddm.StateFlags & DISPLAY_DEVICE_ACTIVE && ddm.StateFlags & DISPLAY_DEVICE_ATTACHED) if (ddm.StateFlags & DISPLAY_DEVICE_ACTIVE && ddm.StateFlags & DISPLAY_DEVICE_ATTACHED)
{ {
wcsncpy_s(monitor.monitorName, ddm.DeviceString, _TRUNCATE); monitor.monitorName.assign(ddm.DeviceString, wcsnlen(ddm.DeviceString, _countof(ddm.DeviceString)));
break; break;
} }
} }
@ -287,9 +287,14 @@ void CSystem::SetMultiMonitorInfo()
{ {
std::wstring msg; std::wstring msg;
std::wstring deviceName(dd.DeviceName, wcsnlen(dd.DeviceName, _countof(dd.DeviceName)));
std::wstring deviceString;
if (logging) if (logging)
{ {
Log(LOG_DEBUG, dd.DeviceName); deviceString.assign(dd.DeviceString, wcsnlen(dd.DeviceString, _countof(dd.DeviceString)));
Log(LOG_DEBUG, deviceName.c_str());
if (dd.StateFlags & DISPLAY_DEVICE_ACTIVE) if (dd.StateFlags & DISPLAY_DEVICE_ACTIVE)
{ {
@ -334,20 +339,20 @@ void CSystem::SetMultiMonitorInfo()
MONITOR_INFO monitor = {0}; MONITOR_INFO monitor = {0};
monitor.handle = NULL; monitor.handle = NULL;
wcsncpy_s(monitor.deviceName, dd.DeviceName, _TRUNCATE); // E.g. "\\.\DISPLAY1" monitor.deviceName = deviceName; // E.g. "\\.\DISPLAY1"
// Get the monitor name (E.g. "Generic Non-PnP Monitor") // Get the monitor name (E.g. "Generic Non-PnP Monitor")
DISPLAY_DEVICE ddm = {sizeof(DISPLAY_DEVICE)}; DISPLAY_DEVICE ddm = {sizeof(DISPLAY_DEVICE)};
DWORD dwMon = 0; DWORD dwMon = 0;
while (EnumDisplayDevices(dd.DeviceName, dwMon++, &ddm, 0)) while (EnumDisplayDevices(deviceName.c_str(), dwMon++, &ddm, 0))
{ {
if (ddm.StateFlags & DISPLAY_DEVICE_ACTIVE && ddm.StateFlags & DISPLAY_DEVICE_ATTACHED) if (ddm.StateFlags & DISPLAY_DEVICE_ACTIVE && ddm.StateFlags & DISPLAY_DEVICE_ATTACHED)
{ {
wcsncpy_s(monitor.monitorName, ddm.DeviceString, _TRUNCATE); monitor.monitorName.assign(ddm.DeviceString, wcsnlen(ddm.DeviceString, _countof(ddm.DeviceString)));
if (logging) if (logging)
{ {
LogWithArgs(LOG_DEBUG, L" Name : %s", ddm.DeviceString); LogWithArgs(LOG_DEBUG, L" Name : %s", monitor.monitorName.c_str());
} }
break; break;
} }
@ -355,7 +360,7 @@ void CSystem::SetMultiMonitorInfo()
if (logging) if (logging)
{ {
LogWithArgs(LOG_DEBUG, L" Adapter : %s", dd.DeviceString); LogWithArgs(LOG_DEBUG, L" Adapter : %s", deviceString.c_str());
LogWithArgs(LOG_DEBUG, L" Flags : %s(0x%08X)", msg.c_str(), dd.StateFlags); LogWithArgs(LOG_DEBUG, L" Flags : %s(0x%08X)", msg.c_str(), dd.StateFlags);
} }
@ -366,7 +371,7 @@ void CSystem::SetMultiMonitorInfo()
DEVMODE dm = {0}; DEVMODE dm = {0};
dm.dmSize = sizeof(DEVMODE); dm.dmSize = sizeof(DEVMODE);
if (EnumDisplaySettings(dd.DeviceName, ENUM_CURRENT_SETTINGS, &dm)) if (EnumDisplaySettings(deviceName.c_str(), ENUM_CURRENT_SETTINGS, &dm))
{ {
POINT pos = {dm.dmPosition.x, dm.dmPosition.y}; POINT pos = {dm.dmPosition.x, dm.dmPosition.y};
monitor.handle = MonitorFromPoint(pos, MONITOR_DEFAULTTONULL); monitor.handle = MonitorFromPoint(pos, MONITOR_DEFAULTTONULL);
@ -417,7 +422,7 @@ void CSystem::SetMultiMonitorInfo()
{ {
if (logging) if (logging)
{ {
LogWithArgs(LOG_DEBUG, L" Adapter : %s", dd.DeviceString); LogWithArgs(LOG_DEBUG, L" Adapter : %s", deviceString.c_str());
LogWithArgs(LOG_DEBUG, L" Flags : %s(0x%08X)", msg.c_str(), dd.StateFlags); LogWithArgs(LOG_DEBUG, L" Flags : %s(0x%08X)", msg.c_str(), dd.StateFlags);
} }
} }
@ -448,16 +453,21 @@ void CSystem::SetMultiMonitorInfo()
Log(LOG_WARNING, L"Failed to enumerate monitors. Using dummy monitor info."); Log(LOG_WARNING, L"Failed to enumerate monitors. Using dummy monitor info.");
c_Monitors.useEnumDisplayMonitors = false; c_Monitors.useEnumDisplayMonitors = false;
MONITOR_INFO monitor = {0}; MONITOR_INFO monitor;
wcsncpy_s(monitor.deviceName, L"DUMMY", _TRUNCATE); monitor.active = true;
POINT pos = {0, 0}; POINT pos = {0, 0};
monitor.handle = MonitorFromPoint(pos, MONITOR_DEFAULTTOPRIMARY); monitor.handle = MonitorFromPoint(pos, MONITOR_DEFAULTTOPRIMARY);
monitor.screen.left = 0; monitor.screen.left = 0;
monitor.screen.top = 0; monitor.screen.top = 0;
monitor.screen.right = GetSystemMetrics(SM_CXSCREEN); monitor.screen.right = GetSystemMetrics(SM_CXSCREEN);
monitor.screen.bottom = GetSystemMetrics(SM_CYSCREEN); monitor.screen.bottom = GetSystemMetrics(SM_CYSCREEN);
SystemParametersInfo(SPI_GETWORKAREA, 0, &(monitor.work), 0); if (SystemParametersInfo(SPI_GETWORKAREA, 0, &(monitor.work), 0) == 0) // failed
monitor.active = true; {
monitor.work = monitor.screen;
}
monitor.deviceName = L"DUMMY";
monitors.push_back(monitor); monitors.push_back(monitor);
@ -498,14 +508,14 @@ void CSystem::SetMultiMonitorInfo()
{ {
if (monitors[i].active) if (monitors[i].active)
{ {
LogWithArgs(LOG_DEBUG, L"@%i: %s (active), MonitorName: %s", (int)i + 1, monitors[i].deviceName, monitors[i].monitorName); LogWithArgs(LOG_DEBUG, L"@%i: %s (active), MonitorName: %s", (int)i + 1, monitors[i].deviceName.c_str(), monitors[i].monitorName.c_str());
LogWithArgs(LOG_DEBUG, L" L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)", LogWithArgs(LOG_DEBUG, L" L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)",
monitors[i].screen.left, monitors[i].screen.top, monitors[i].screen.right, monitors[i].screen.bottom, monitors[i].screen.left, monitors[i].screen.top, monitors[i].screen.right, monitors[i].screen.bottom,
monitors[i].screen.right - monitors[i].screen.left, monitors[i].screen.bottom - monitors[i].screen.top); monitors[i].screen.right - monitors[i].screen.left, monitors[i].screen.bottom - monitors[i].screen.top);
} }
else else
{ {
LogWithArgs(LOG_DEBUG, L"@%i: %s (inactive), MonitorName: %s", (int)i + 1, monitors[i].deviceName, monitors[i].monitorName); LogWithArgs(LOG_DEBUG, L"@%i: %s (inactive), MonitorName: %s", (int)i + 1, monitors[i].deviceName.c_str(), monitors[i].monitorName.c_str());
} }
} }
Log(LOG_DEBUG, L"------------------------------"); Log(LOG_DEBUG, L"------------------------------");

View File

@ -36,8 +36,8 @@ struct MONITOR_INFO
HMONITOR handle; HMONITOR handle;
RECT screen; RECT screen;
RECT work; RECT work;
WCHAR deviceName[32]; //Device name (E.g. "\\.\DISPLAY1") std::wstring deviceName; //Device name (E.g. "\\.\DISPLAY1")
WCHAR monitorName[128]; //Monitor name (E.g. "Generic Non-PnP Monitor") std::wstring monitorName; //Monitor name (E.g. "Generic Non-PnP Monitor")
}; };
struct MULTIMONITOR_INFO struct MULTIMONITOR_INFO

View File

@ -44,8 +44,8 @@ public:
} }
std::transform(key.begin(), key.end(), key.begin(), ::towlower); std::transform(key.begin(), key.end(), key.begin(), ::towlower);
_snwprintf_s(buffer, _TRUNCATE, L":%llx:%x", time, size); size_t len = _snwprintf_s(buffer, _TRUNCATE, L":%llx:%x", time, size);
key += buffer; key.append(buffer, len);
return key; return key;
} }