mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Core dll:
- Replace swprintf/wsprintf/wcscpy/wcscat to _snwprintf_s/wcsncpy_s/wcsncat_s. - Changed printf format parameter strictly for supporting both 32bit and 64bit. - Fixed an issue that !RainmeterWriteKeyValue doesn't accept %APPDATA%\Rainmeter path. - Code cleanup.
This commit is contained in:
parent
806a86fe65
commit
d1a7b604df
@ -204,10 +204,10 @@ void UpdateAboutStatistics(LPCTSTR entryName)
|
|||||||
WCHAR buffer[256];
|
WCHAR buffer[256];
|
||||||
double minVal = (*i)->GetMinValue();
|
double minVal = (*i)->GetMinValue();
|
||||||
double maxVal = (*i)->GetMaxValue();
|
double maxVal = (*i)->GetMaxValue();
|
||||||
CMeasure::GetScaledValue(1, minVal, buffer);
|
CMeasure::GetScaledValue(1, minVal, buffer, _countof(buffer));
|
||||||
std::wstring range = buffer;
|
std::wstring range = buffer;
|
||||||
range += L" - ";
|
range += L" - ";
|
||||||
CMeasure::GetScaledValue(1, maxVal, buffer);
|
CMeasure::GetScaledValue(1, maxVal, buffer, _countof(buffer));
|
||||||
range += buffer;
|
range += buffer;
|
||||||
|
|
||||||
if (name && *name)
|
if (name && *name)
|
||||||
@ -306,7 +306,7 @@ void UpdateWidgets()
|
|||||||
if ((*iter).version != 0)
|
if ((*iter).version != 0)
|
||||||
{
|
{
|
||||||
WCHAR buffer[64];
|
WCHAR buffer[64];
|
||||||
swprintf(buffer, L"%i.%i", (*iter).version / 1000, (*iter).version % 1000);
|
_snwprintf_s(buffer, _TRUNCATE, L"%u.%u", (*iter).version / 1000, (*iter).version % 1000);
|
||||||
ListView_SetItemText(widget, i, 1, buffer);
|
ListView_SetItemText(widget, i, 1, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,7 +380,7 @@ void ScanPlugins()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DebugLog(L"Unable to load library: \"%s\", ErrorCode=%i", tmpSz.c_str(), err);
|
DebugLog(L"Unable to load library: \"%s\", ErrorCode=%u", tmpSz.c_str(), err);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_Plugins.push_back(info);
|
g_Plugins.push_back(info);
|
||||||
@ -429,11 +429,11 @@ BOOL OnInitAboutDialog(HWND window)
|
|||||||
HWND widget;
|
HWND widget;
|
||||||
|
|
||||||
widget = GetDlgItem(window, IDC_VERSION_STRING);
|
widget = GetDlgItem(window, IDC_VERSION_STRING);
|
||||||
swprintf(tmpSz, L"%s %s%s rev %i %s", APPNAME, APPVERSION, revision_beta ? L" Beta" : L"", revision_number, APPBITS);
|
_snwprintf_s(tmpSz, _TRUNCATE, L"%s %s%s rev %i %s", APPNAME, APPVERSION, revision_beta ? L" Beta" : L"", revision_number, APPBITS);
|
||||||
SetWindowText(widget, tmpSz);
|
SetWindowText(widget, tmpSz);
|
||||||
|
|
||||||
widget = GetDlgItem(window, IDC_BUILD_STRING);
|
widget = GetDlgItem(window, IDC_BUILD_STRING);
|
||||||
swprintf(tmpSz, L"Built on %s", ConvertToWide(__DATE__).c_str());
|
_snwprintf_s(tmpSz, _TRUNCATE, L"Built on %s", ConvertToWide(__DATE__).c_str());
|
||||||
SetWindowText(widget, tmpSz);
|
SetWindowText(widget, tmpSz);
|
||||||
|
|
||||||
CheckDlgButton(window, IDC_DISABLE_VERSION_CHECK, Rainmeter->GetDisableVersionCheck() ? BST_CHECKED : BST_UNCHECKED);
|
CheckDlgButton(window, IDC_DISABLE_VERSION_CHECK, Rainmeter->GetDisableVersionCheck() ? BST_CHECKED : BST_UNCHECKED);
|
||||||
|
@ -145,7 +145,7 @@ void CConfigParser::ReadVariables()
|
|||||||
*/
|
*/
|
||||||
void CConfigParser::SetVariable(std::map<std::wstring, std::wstring>& variables, const std::wstring& strVariable, const std::wstring& strValue)
|
void CConfigParser::SetVariable(std::map<std::wstring, std::wstring>& variables, const std::wstring& strVariable, const std::wstring& strValue)
|
||||||
{
|
{
|
||||||
// DebugLog(L"Variable: %s=%s (size=%i)", strVariable.c_str(), strValue.c_str(), m_Variables.size());
|
// DebugLog(L"Variable: %s=%s (size=%i)", strVariable.c_str(), strValue.c_str(), (int)m_Variables.size());
|
||||||
|
|
||||||
std::wstring strTmp(strVariable);
|
std::wstring strTmp(strVariable);
|
||||||
std::transform(strTmp.begin(), strTmp.end(), strTmp.begin(), ::towlower);
|
std::transform(strTmp.begin(), strTmp.end(), strTmp.begin(), ::towlower);
|
||||||
@ -230,16 +230,16 @@ void CConfigParser::SetMultiMonitorVariables(bool reset)
|
|||||||
|
|
||||||
SystemParametersInfo(SPI_GETWORKAREA, 0, &workArea, 0);
|
SystemParametersInfo(SPI_GETWORKAREA, 0, &workArea, 0);
|
||||||
|
|
||||||
swprintf(buffer, L"%i", workArea.left);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", workArea.left);
|
||||||
SetMonitorVariable(L"WORKAREAX", buffer);
|
SetMonitorVariable(L"WORKAREAX", buffer);
|
||||||
SetMonitorVariable(L"PWORKAREAX", buffer);
|
SetMonitorVariable(L"PWORKAREAX", buffer);
|
||||||
swprintf(buffer, L"%i", workArea.top);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", workArea.top);
|
||||||
SetMonitorVariable(L"WORKAREAY", buffer);
|
SetMonitorVariable(L"WORKAREAY", buffer);
|
||||||
SetMonitorVariable(L"PWORKAREAY", buffer);
|
SetMonitorVariable(L"PWORKAREAY", buffer);
|
||||||
swprintf(buffer, L"%i", workArea.right - workArea.left);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", workArea.right - workArea.left);
|
||||||
SetMonitorVariable(L"WORKAREAWIDTH", buffer);
|
SetMonitorVariable(L"WORKAREAWIDTH", buffer);
|
||||||
SetMonitorVariable(L"PWORKAREAWIDTH", buffer);
|
SetMonitorVariable(L"PWORKAREAWIDTH", buffer);
|
||||||
swprintf(buffer, L"%i", workArea.bottom - workArea.top);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", workArea.bottom - workArea.top);
|
||||||
SetMonitorVariable(L"WORKAREAHEIGHT", buffer);
|
SetMonitorVariable(L"WORKAREAHEIGHT", buffer);
|
||||||
SetMonitorVariable(L"PWORKAREAHEIGHT", buffer);
|
SetMonitorVariable(L"PWORKAREAHEIGHT", buffer);
|
||||||
|
|
||||||
@ -250,26 +250,26 @@ void CConfigParser::SetMultiMonitorVariables(bool reset)
|
|||||||
scrArea.right = GetSystemMetrics(SM_CXSCREEN);
|
scrArea.right = GetSystemMetrics(SM_CXSCREEN);
|
||||||
scrArea.bottom = GetSystemMetrics(SM_CYSCREEN);
|
scrArea.bottom = GetSystemMetrics(SM_CYSCREEN);
|
||||||
|
|
||||||
swprintf(buffer, L"%i", scrArea.left);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", scrArea.left);
|
||||||
SetMonitorVariable(L"SCREENAREAX", buffer);
|
SetMonitorVariable(L"SCREENAREAX", buffer);
|
||||||
SetMonitorVariable(L"PSCREENAREAX", buffer);
|
SetMonitorVariable(L"PSCREENAREAX", buffer);
|
||||||
swprintf(buffer, L"%i", scrArea.top);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", scrArea.top);
|
||||||
SetMonitorVariable(L"SCREENAREAY", buffer);
|
SetMonitorVariable(L"SCREENAREAY", buffer);
|
||||||
SetMonitorVariable(L"PSCREENAREAY", buffer);
|
SetMonitorVariable(L"PSCREENAREAY", buffer);
|
||||||
swprintf(buffer, L"%i", scrArea.right - scrArea.left);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", scrArea.right - scrArea.left);
|
||||||
SetMonitorVariable(L"SCREENAREAWIDTH", buffer);
|
SetMonitorVariable(L"SCREENAREAWIDTH", buffer);
|
||||||
SetMonitorVariable(L"PSCREENAREAWIDTH", buffer);
|
SetMonitorVariable(L"PSCREENAREAWIDTH", buffer);
|
||||||
swprintf(buffer, L"%i", scrArea.bottom - scrArea.top);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", scrArea.bottom - scrArea.top);
|
||||||
SetMonitorVariable(L"SCREENAREAHEIGHT", buffer);
|
SetMonitorVariable(L"SCREENAREAHEIGHT", buffer);
|
||||||
SetMonitorVariable(L"PSCREENAREAHEIGHT", buffer);
|
SetMonitorVariable(L"PSCREENAREAHEIGHT", buffer);
|
||||||
|
|
||||||
swprintf(buffer, L"%i", GetSystemMetrics(SM_XVIRTUALSCREEN));
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", GetSystemMetrics(SM_XVIRTUALSCREEN));
|
||||||
SetMonitorVariable(L"VSCREENAREAX", buffer);
|
SetMonitorVariable(L"VSCREENAREAX", buffer);
|
||||||
swprintf(buffer, L"%i", GetSystemMetrics(SM_YVIRTUALSCREEN));
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", GetSystemMetrics(SM_YVIRTUALSCREEN));
|
||||||
SetMonitorVariable(L"VSCREENAREAY", buffer);
|
SetMonitorVariable(L"VSCREENAREAY", buffer);
|
||||||
swprintf(buffer, L"%i", GetSystemMetrics(SM_CXVIRTUALSCREEN));
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", GetSystemMetrics(SM_CXVIRTUALSCREEN));
|
||||||
SetMonitorVariable(L"VSCREENAREAWIDTH", buffer);
|
SetMonitorVariable(L"VSCREENAREAWIDTH", buffer);
|
||||||
swprintf(buffer, L"%i", GetSystemMetrics(SM_CYVIRTUALSCREEN));
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", GetSystemMetrics(SM_CYVIRTUALSCREEN));
|
||||||
SetMonitorVariable(L"VSCREENAREAHEIGHT", buffer);
|
SetMonitorVariable(L"VSCREENAREAHEIGHT", buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,34 +284,34 @@ void CConfigParser::SetMultiMonitorVariables(bool reset)
|
|||||||
|
|
||||||
const RECT work = (monitors[i].active) ? monitors[i].work : workArea;
|
const RECT work = (monitors[i].active) ? monitors[i].work : workArea;
|
||||||
|
|
||||||
swprintf(buffer, L"%i", work.left);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", work.left);
|
||||||
swprintf(buffer2, L"WORKAREAX@%i", i + 1);
|
_snwprintf_s(buffer2, _TRUNCATE, L"WORKAREAX@%i", (int)i + 1);
|
||||||
SetMonitorVariable(buffer2, buffer);
|
SetMonitorVariable(buffer2, buffer);
|
||||||
swprintf(buffer, L"%i", work.top);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", work.top);
|
||||||
swprintf(buffer2, L"WORKAREAY@%i", i + 1);
|
_snwprintf_s(buffer2, _TRUNCATE, L"WORKAREAY@%i", (int)i + 1);
|
||||||
SetMonitorVariable(buffer2, buffer);
|
SetMonitorVariable(buffer2, buffer);
|
||||||
swprintf(buffer, L"%i", work.right - work.left);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", work.right - work.left);
|
||||||
swprintf(buffer2, L"WORKAREAWIDTH@%i", i + 1);
|
_snwprintf_s(buffer2, _TRUNCATE, L"WORKAREAWIDTH@%i", (int)i + 1);
|
||||||
SetMonitorVariable(buffer2, buffer);
|
SetMonitorVariable(buffer2, buffer);
|
||||||
swprintf(buffer, L"%i", work.bottom - work.top);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", work.bottom - work.top);
|
||||||
swprintf(buffer2, L"WORKAREAHEIGHT@%i", i + 1);
|
_snwprintf_s(buffer2, _TRUNCATE, L"WORKAREAHEIGHT@%i", (int)i + 1);
|
||||||
SetMonitorVariable(buffer2, buffer);
|
SetMonitorVariable(buffer2, buffer);
|
||||||
|
|
||||||
if (reset)
|
if (reset)
|
||||||
{
|
{
|
||||||
const RECT screen = (monitors[i].active) ? monitors[i].screen : scrArea;
|
const RECT screen = (monitors[i].active) ? monitors[i].screen : scrArea;
|
||||||
|
|
||||||
swprintf(buffer, L"%i", screen.left);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", screen.left);
|
||||||
swprintf(buffer2, L"SCREENAREAX@%i", i + 1);
|
_snwprintf_s(buffer2, _TRUNCATE, L"SCREENAREAX@%i", (int)i + 1);
|
||||||
SetMonitorVariable(buffer2, buffer);
|
SetMonitorVariable(buffer2, buffer);
|
||||||
swprintf(buffer, L"%i", screen.top);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", screen.top);
|
||||||
swprintf(buffer2, L"SCREENAREAY@%i", i + 1);
|
_snwprintf_s(buffer2, _TRUNCATE, L"SCREENAREAY@%i", (int)i + 1);
|
||||||
SetMonitorVariable(buffer2, buffer);
|
SetMonitorVariable(buffer2, buffer);
|
||||||
swprintf(buffer, L"%i", screen.right - screen.left);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", screen.right - screen.left);
|
||||||
swprintf(buffer2, L"SCREENAREAWIDTH@%i", i + 1);
|
_snwprintf_s(buffer2, _TRUNCATE, L"SCREENAREAWIDTH@%i", (int)i + 1);
|
||||||
SetMonitorVariable(buffer2, buffer);
|
SetMonitorVariable(buffer2, buffer);
|
||||||
swprintf(buffer, L"%i", screen.bottom - screen.top);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", screen.bottom - screen.top);
|
||||||
swprintf(buffer2, L"SCREENAREAHEIGHT@%i", i + 1);
|
_snwprintf_s(buffer2, _TRUNCATE, L"SCREENAREAHEIGHT@%i", (int)i + 1);
|
||||||
SetMonitorVariable(buffer2, buffer);
|
SetMonitorVariable(buffer2, buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -362,13 +362,13 @@ void CConfigParser::SetAutoSelectedMonitorVariables(CMeterWindow* meterWindow)
|
|||||||
s2 = monitors[screenIndex-1].screen.right - monitors[screenIndex-1].screen.left;
|
s2 = monitors[screenIndex-1].screen.right - monitors[screenIndex-1].screen.left;
|
||||||
}
|
}
|
||||||
|
|
||||||
swprintf(buffer, L"%i", w1);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", w1);
|
||||||
SetBuiltInVariable(L"WORKAREAX", buffer);
|
SetBuiltInVariable(L"WORKAREAX", buffer);
|
||||||
swprintf(buffer, L"%i", w2);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", w2);
|
||||||
SetBuiltInVariable(L"WORKAREAWIDTH", buffer);
|
SetBuiltInVariable(L"WORKAREAWIDTH", buffer);
|
||||||
swprintf(buffer, L"%i", s1);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", s1);
|
||||||
SetBuiltInVariable(L"SCREENAREAX", buffer);
|
SetBuiltInVariable(L"SCREENAREAX", buffer);
|
||||||
swprintf(buffer, L"%i", s2);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", s2);
|
||||||
SetBuiltInVariable(L"SCREENAREAWIDTH", buffer);
|
SetBuiltInVariable(L"SCREENAREAWIDTH", buffer);
|
||||||
|
|
||||||
// Set Y / HEIGHT
|
// Set Y / HEIGHT
|
||||||
@ -395,13 +395,13 @@ void CConfigParser::SetAutoSelectedMonitorVariables(CMeterWindow* meterWindow)
|
|||||||
s2 = monitors[screenIndex-1].screen.bottom - monitors[screenIndex-1].screen.top;
|
s2 = monitors[screenIndex-1].screen.bottom - monitors[screenIndex-1].screen.top;
|
||||||
}
|
}
|
||||||
|
|
||||||
swprintf(buffer, L"%i", w1);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", w1);
|
||||||
SetBuiltInVariable(L"WORKAREAY", buffer);
|
SetBuiltInVariable(L"WORKAREAY", buffer);
|
||||||
swprintf(buffer, L"%i", w2);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", w2);
|
||||||
SetBuiltInVariable(L"WORKAREAHEIGHT", buffer);
|
SetBuiltInVariable(L"WORKAREAHEIGHT", buffer);
|
||||||
swprintf(buffer, L"%i", s1);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", s1);
|
||||||
SetBuiltInVariable(L"SCREENAREAY", buffer);
|
SetBuiltInVariable(L"SCREENAREAY", buffer);
|
||||||
swprintf(buffer, L"%i", s2);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", s2);
|
||||||
SetBuiltInVariable(L"SCREENAREAHEIGHT", buffer);
|
SetBuiltInVariable(L"SCREENAREAHEIGHT", buffer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -411,13 +411,13 @@ void CConfigParser::SetAutoSelectedMonitorVariables(CMeterWindow* meterWindow)
|
|||||||
// Set default WORKAREA
|
// Set default WORKAREA
|
||||||
SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
|
SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
|
||||||
|
|
||||||
swprintf(buffer, L"%i", r.left);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", r.left);
|
||||||
SetBuiltInVariable(L"WORKAREAX", buffer);
|
SetBuiltInVariable(L"WORKAREAX", buffer);
|
||||||
swprintf(buffer, L"%i", r.top);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", r.top);
|
||||||
SetBuiltInVariable(L"WORKAREAY", buffer);
|
SetBuiltInVariable(L"WORKAREAY", buffer);
|
||||||
swprintf(buffer, L"%i", r.right - r.left);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", r.right - r.left);
|
||||||
SetBuiltInVariable(L"WORKAREAWIDTH", buffer);
|
SetBuiltInVariable(L"WORKAREAWIDTH", buffer);
|
||||||
swprintf(buffer, L"%i", r.bottom - r.top);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", r.bottom - r.top);
|
||||||
SetBuiltInVariable(L"WORKAREAHEIGHT", buffer);
|
SetBuiltInVariable(L"WORKAREAHEIGHT", buffer);
|
||||||
|
|
||||||
// Set default SCREENAREA
|
// Set default SCREENAREA
|
||||||
@ -426,13 +426,13 @@ void CConfigParser::SetAutoSelectedMonitorVariables(CMeterWindow* meterWindow)
|
|||||||
r.right = GetSystemMetrics(SM_CXSCREEN);
|
r.right = GetSystemMetrics(SM_CXSCREEN);
|
||||||
r.bottom = GetSystemMetrics(SM_CYSCREEN);
|
r.bottom = GetSystemMetrics(SM_CYSCREEN);
|
||||||
|
|
||||||
swprintf(buffer, L"%i", r.left);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", r.left);
|
||||||
SetBuiltInVariable(L"SCREENAREAX", buffer);
|
SetBuiltInVariable(L"SCREENAREAX", buffer);
|
||||||
swprintf(buffer, L"%i", r.top);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", r.top);
|
||||||
SetBuiltInVariable(L"SCREENAREAY", buffer);
|
SetBuiltInVariable(L"SCREENAREAY", buffer);
|
||||||
swprintf(buffer, L"%i", r.right - r.left);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", r.right - r.left);
|
||||||
SetBuiltInVariable(L"SCREENAREAWIDTH", buffer);
|
SetBuiltInVariable(L"SCREENAREAWIDTH", buffer);
|
||||||
swprintf(buffer, L"%i", r.bottom - r.top);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", r.bottom - r.top);
|
||||||
SetBuiltInVariable(L"SCREENAREAHEIGHT", buffer);
|
SetBuiltInVariable(L"SCREENAREAHEIGHT", buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -613,7 +613,7 @@ const std::wstring& CConfigParser::ReadString(LPCTSTR section, LPCTSTR key, LPCT
|
|||||||
|
|
||||||
const std::wstring& strStyle = GetValue(strSection, key, strDefault);
|
const std::wstring& strStyle = GetValue(strSection, key, strDefault);
|
||||||
|
|
||||||
//DebugLog(L"[%s] %s (from [%s]) : strDefault=%s (0x%08X), strStyle=%s (0x%08X)",
|
//DebugLog(L"[%s] %s (from [%s]) : strDefault=%s (0x%p), strStyle=%s (0x%p)",
|
||||||
// section, key, strSection.c_str(), strDefault.c_str(), &strDefault, strStyle.c_str(), &strStyle);
|
// section, key, strSection.c_str(), strDefault.c_str(), &strDefault, strStyle.c_str(), &strStyle);
|
||||||
|
|
||||||
if (&strStyle != &strDefault)
|
if (&strStyle != &strDefault)
|
||||||
@ -1187,7 +1187,7 @@ void CConfigParser::ReadIniFile(const std::vector<std::wstring>& iniFileMappings
|
|||||||
*/
|
*/
|
||||||
void CConfigParser::SetValue(const std::wstring& strSection, const std::wstring& strKey, const std::wstring& strValue)
|
void CConfigParser::SetValue(const std::wstring& strSection, const std::wstring& strKey, const std::wstring& strValue)
|
||||||
{
|
{
|
||||||
// DebugLog(L"[%s] %s=%s (size: %i)", strSection.c_str(), strKey.c_str(), strValue.c_str(), m_Values.size());
|
// DebugLog(L"[%s] %s=%s (size: %i)", strSection.c_str(), strKey.c_str(), strValue.c_str(), (int)m_Values.size());
|
||||||
|
|
||||||
std::wstring strTmpSection(strSection);
|
std::wstring strTmpSection(strSection);
|
||||||
std::wstring strTmpKey(strKey);
|
std::wstring strTmpKey(strKey);
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
#ifndef __CONFIGPARSER_H__
|
#ifndef __CONFIGPARSER_H__
|
||||||
#define __CONFIGPARSER_H__
|
#define __CONFIGPARSER_H__
|
||||||
|
|
||||||
|
#pragma warning(disable: 4503)
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -43,7 +43,7 @@ const std::wstring& CError::GetString()
|
|||||||
m_String = c_ErrorStrings[m_Error];
|
m_String = c_ErrorStrings[m_Error];
|
||||||
// if (m_File)
|
// if (m_File)
|
||||||
// {
|
// {
|
||||||
// swprintf(Buffer, L"%i", m_Line);
|
// _snwprintf_s(Buffer, _TRUNCATE, L"%i", m_Line);
|
||||||
//
|
//
|
||||||
// m_String += L"\n(";
|
// m_String += L"\n(";
|
||||||
// m_String += m_File;
|
// m_String += m_File;
|
||||||
|
@ -515,7 +515,7 @@ BOOL LSLog(int nLevel, LPCTSTR pszModule, LPCTSTR pszMessage)
|
|||||||
startTime = time;
|
startTime = time;
|
||||||
}
|
}
|
||||||
WCHAR buffer[128];
|
WCHAR buffer[128];
|
||||||
swprintf(buffer, L"(%02i:%02i:%02i.%03i) ", (time - startTime) / (1000 * 60* 60), ((time - startTime) / (1000 * 60)) % 60, ((time - startTime) / 1000) % 60, (time - startTime) % 1000);
|
_snwprintf_s(buffer, _TRUNCATE, L"(%02i:%02i:%02i.%03i) ", (time - startTime) / (1000 * 60* 60), ((time - startTime) / (1000 * 60)) % 60, ((time - startTime) / 1000) % 60, (time - startTime) % 1000);
|
||||||
|
|
||||||
std::wstring message(buffer);
|
std::wstring message(buffer);
|
||||||
logInfo.timestamp = message;
|
logInfo.timestamp = message;
|
||||||
@ -615,10 +615,10 @@ void DebugLog(const WCHAR* format, ... )
|
|||||||
_CrtSetReportMode(_CRT_ASSERT, 0);
|
_CrtSetReportMode(_CRT_ASSERT, 0);
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
_vsnwprintf_s( buffer, 4096, _TRUNCATE, format, args );
|
_vsnwprintf_s( buffer, _TRUNCATE, format, args );
|
||||||
if (errno != 0)
|
if (errno != 0)
|
||||||
{
|
{
|
||||||
_snwprintf_s(buffer, 4096, _TRUNCATE, L"DebugLog internal error: %s", format);
|
_snwprintf_s(buffer, _TRUNCATE, L"DebugLog internal error: %s", format);
|
||||||
}
|
}
|
||||||
|
|
||||||
_set_invalid_parameter_handler(oldHandler);
|
_set_invalid_parameter_handler(oldHandler);
|
||||||
|
@ -511,17 +511,17 @@ const WCHAR* CMeasure::GetStringValue(bool autoScale, double scale, int decimals
|
|||||||
|
|
||||||
if (decimals == 0)
|
if (decimals == 0)
|
||||||
{
|
{
|
||||||
swprintf(buffer, L"%i", (UINT)val);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", (int)val);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
swprintf(format, L"%%.%if", decimals);
|
_snwprintf_s(format, _TRUNCATE, L"%%.%if", decimals);
|
||||||
swprintf(buffer, format, val);
|
_snwprintf_s(buffer, _TRUNCATE, format, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(autoScale)
|
else if(autoScale)
|
||||||
{
|
{
|
||||||
GetScaledValue(decimals, GetValue(), buffer);
|
GetScaledValue(decimals, GetValue(), buffer, _countof(buffer));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -530,11 +530,11 @@ const WCHAR* CMeasure::GetStringValue(bool autoScale, double scale, int decimals
|
|||||||
if(decimals == 0)
|
if(decimals == 0)
|
||||||
{
|
{
|
||||||
val += (val >= 0) ? 0.5 : -0.5;
|
val += (val >= 0) ? 0.5 : -0.5;
|
||||||
swprintf(buffer, L"%lli", (LONGLONG)val);
|
_snwprintf_s(buffer, _TRUNCATE, L"%lli", (LONGLONG)val);
|
||||||
}
|
}
|
||||||
else if (decimals == -1)
|
else if (decimals == -1)
|
||||||
{
|
{
|
||||||
swprintf(buffer, L"%.5f", val);
|
_snwprintf_s(buffer, _TRUNCATE, L"%.5f", val);
|
||||||
|
|
||||||
size_t len = wcslen(buffer);
|
size_t len = wcslen(buffer);
|
||||||
if (len >= 6 && wcscmp(&buffer[len - 6], L".00000") == 0)
|
if (len >= 6 && wcscmp(&buffer[len - 6], L".00000") == 0)
|
||||||
@ -544,54 +544,54 @@ const WCHAR* CMeasure::GetStringValue(bool autoScale, double scale, int decimals
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
swprintf(format, L"%%.%if", decimals);
|
_snwprintf_s(format, _TRUNCATE, L"%%.%if", decimals);
|
||||||
swprintf(buffer, format, val);
|
_snwprintf_s(buffer, _TRUNCATE, format, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return CheckSubstitute(buffer);
|
return CheckSubstitute(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMeasure::GetScaledValue(int decimals, double theValue, WCHAR* buffer)
|
void CMeasure::GetScaledValue(int decimals, double theValue, WCHAR* buffer, size_t sizeInWords)
|
||||||
{
|
{
|
||||||
WCHAR format[32];
|
WCHAR format[32];
|
||||||
double value = 0;
|
double value = 0;
|
||||||
|
|
||||||
if(decimals == 0)
|
if(decimals == 0)
|
||||||
{
|
{
|
||||||
wcscpy(format, L"%.0f");
|
wcsncpy_s(format, L"%.0f", _TRUNCATE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
swprintf(format, L"%%.%if", decimals);
|
_snwprintf_s(format, _TRUNCATE, L"%%.%if", decimals);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(theValue > 1000.0 * 1000.0 * 1000.0 * 1000.0)
|
if(theValue > 1000.0 * 1000.0 * 1000.0 * 1000.0)
|
||||||
{
|
{
|
||||||
wcscat(format, L" T");
|
wcsncat_s(format, L" T", _TRUNCATE);
|
||||||
value = theValue / (1024.0 * 1024.0 * 1024.0 * 1024.0);
|
value = theValue / (1024.0 * 1024.0 * 1024.0 * 1024.0);
|
||||||
}
|
}
|
||||||
else if(theValue > 1000.0 * 1000.0 * 1000.0)
|
else if(theValue > 1000.0 * 1000.0 * 1000.0)
|
||||||
{
|
{
|
||||||
wcscat(format, L" G");
|
wcsncat_s(format, L" G", _TRUNCATE);
|
||||||
value = theValue / (1024.0 * 1024.0 * 1024.0);
|
value = theValue / (1024.0 * 1024.0 * 1024.0);
|
||||||
}
|
}
|
||||||
else if(theValue > 1000.0 * 1000.0)
|
else if(theValue > 1000.0 * 1000.0)
|
||||||
{
|
{
|
||||||
wcscat(format, L" M");
|
wcsncat_s(format, L" M", _TRUNCATE);
|
||||||
value = theValue / (1024.0 * 1024.0);
|
value = theValue / (1024.0 * 1024.0);
|
||||||
}
|
}
|
||||||
else if(theValue > 1000.0)
|
else if(theValue > 1000.0)
|
||||||
{
|
{
|
||||||
wcscat(format, L" k");
|
wcsncat_s(format, L" k", _TRUNCATE);
|
||||||
value = theValue / 1024.0;
|
value = theValue / 1024.0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wcscat(format, L" ");
|
wcsncat_s(format, L" ", _TRUNCATE);
|
||||||
value = theValue;
|
value = theValue;
|
||||||
}
|
}
|
||||||
swprintf(buffer, format, value);
|
_snwprintf_s(buffer, sizeInWords, _TRUNCATE, format, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ public:
|
|||||||
UINT GetUpdateDivider() { return m_UpdateDivider; }
|
UINT GetUpdateDivider() { return m_UpdateDivider; }
|
||||||
|
|
||||||
virtual const WCHAR* GetStringValue(bool autoScale, double scale, int decimals, bool percentual);
|
virtual const WCHAR* GetStringValue(bool autoScale, double scale, int decimals, bool percentual);
|
||||||
static void GetScaledValue(int decimals, double theValue, WCHAR* buffer);
|
static void GetScaledValue(int decimals, double theValue, WCHAR* buffer, size_t sizeInWords);
|
||||||
|
|
||||||
static CMeasure* Create(const WCHAR* measure, CMeterWindow* meterWindow);
|
static CMeasure* Create(const WCHAR* measure, CMeterWindow* meterWindow);
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ void CMeasureCalc::FormulaReplace()
|
|||||||
int randNumber = m_LowBound + (int)(range * rand()/(RAND_MAX + 1.0));
|
int randNumber = m_LowBound + (int)(range * rand()/(RAND_MAX + 1.0));
|
||||||
|
|
||||||
WCHAR buffer[32];
|
WCHAR buffer[32];
|
||||||
wsprintf(buffer, L"%i", randNumber);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", randNumber);
|
||||||
|
|
||||||
m_Formula.replace(loc, 6, buffer);
|
m_Formula.replace(loc, 6, buffer);
|
||||||
loc += wcslen(buffer);
|
loc += wcslen(buffer);
|
||||||
|
@ -144,7 +144,7 @@ void CMeasureNet::UpdateIFTable()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugLog(L"%i: %s", i + 1, ifTable->Table[i].Description);
|
DebugLog(L"%i: %s", (int)i + 1, ifTable->Table[i].Description);
|
||||||
DebugLog(L" Alias: %s", ifTable->Table[i].Alias);
|
DebugLog(L" Alias: %s", ifTable->Table[i].Alias);
|
||||||
DebugLog(L" Type=%s(%i), Hardware=%s, Filter=%s",
|
DebugLog(L" Type=%s(%i), Hardware=%s, Filter=%s",
|
||||||
type.c_str(), ifTable->Table[i].Type,
|
type.c_str(), ifTable->Table[i].Type,
|
||||||
@ -242,7 +242,7 @@ void CMeasureNet::UpdateIFTable()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugLog(L"%i: %s", i + 1, ConvertToWide(desc.c_str()).c_str());
|
DebugLog(L"%i: %s", (int)i + 1, ConvertToWide(desc.c_str()).c_str());
|
||||||
DebugLog(L" Type=%s(%i)",
|
DebugLog(L" Type=%s(%i)",
|
||||||
type.c_str(), ifTable->table[i].dwType);
|
type.c_str(), ifTable->table[i].dwType);
|
||||||
}
|
}
|
||||||
@ -589,18 +589,18 @@ void CMeasureNet::ReadStats(const std::wstring& iniFile)
|
|||||||
{
|
{
|
||||||
ULARGE_INTEGER value;
|
ULARGE_INTEGER value;
|
||||||
|
|
||||||
wsprintf(buffer, L"NetStatsInHigh%i", i);
|
_snwprintf_s(buffer, _TRUNCATE, L"NetStatsInHigh%i", i);
|
||||||
value.HighPart = (DWORD)GetPrivateProfileInt(L"Statistics", buffer, 0, iniFile.c_str());
|
value.HighPart = (DWORD)GetPrivateProfileInt(L"Statistics", buffer, 0, iniFile.c_str());
|
||||||
|
|
||||||
wsprintf(buffer, L"NetStatsInLow%i", i);
|
_snwprintf_s(buffer, _TRUNCATE, L"NetStatsInLow%i", i);
|
||||||
value.LowPart = (DWORD)GetPrivateProfileInt(L"Statistics", buffer, 0, iniFile.c_str());
|
value.LowPart = (DWORD)GetPrivateProfileInt(L"Statistics", buffer, 0, iniFile.c_str());
|
||||||
|
|
||||||
c_StatValues.push_back(value.QuadPart);
|
c_StatValues.push_back(value.QuadPart);
|
||||||
|
|
||||||
wsprintf(buffer, L"NetStatsOutHigh%i", i);
|
_snwprintf_s(buffer, _TRUNCATE, L"NetStatsOutHigh%i", i);
|
||||||
value.HighPart = (DWORD)GetPrivateProfileInt(L"Statistics", buffer, 0, iniFile.c_str());
|
value.HighPart = (DWORD)GetPrivateProfileInt(L"Statistics", buffer, 0, iniFile.c_str());
|
||||||
|
|
||||||
wsprintf(buffer, L"NetStatsOutLow%i", i);
|
_snwprintf_s(buffer, _TRUNCATE, L"NetStatsOutLow%i", i);
|
||||||
value.LowPart = (DWORD)GetPrivateProfileInt(L"Statistics", buffer, 0, iniFile.c_str());
|
value.LowPart = (DWORD)GetPrivateProfileInt(L"Statistics", buffer, 0, iniFile.c_str());
|
||||||
|
|
||||||
c_StatValues.push_back(value.QuadPart);
|
c_StatValues.push_back(value.QuadPart);
|
||||||
@ -618,7 +618,7 @@ void CMeasureNet::WriteStats(const std::wstring& iniFile)
|
|||||||
WCHAR buffer[32];
|
WCHAR buffer[32];
|
||||||
WCHAR buffer2[64];
|
WCHAR buffer2[64];
|
||||||
|
|
||||||
wsprintf(buffer, L"%i", c_StatValues.size() / 2);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", (int)c_StatValues.size() / 2);
|
||||||
WritePrivateProfileString(L"Statistics", L"NetStatsCount", buffer, iniFile.c_str());
|
WritePrivateProfileString(L"Statistics", L"NetStatsCount", buffer, iniFile.c_str());
|
||||||
|
|
||||||
for (size_t i = 0; i < c_StatValues.size() / 2; ++i)
|
for (size_t i = 0; i < c_StatValues.size() / 2; ++i)
|
||||||
@ -627,22 +627,22 @@ void CMeasureNet::WriteStats(const std::wstring& iniFile)
|
|||||||
|
|
||||||
value.QuadPart = c_StatValues[i * 2];
|
value.QuadPart = c_StatValues[i * 2];
|
||||||
|
|
||||||
wsprintf(buffer2, L"NetStatsInHigh%i", i + 1);
|
_snwprintf_s(buffer2, _TRUNCATE, L"NetStatsInHigh%i", (int)i + 1);
|
||||||
wsprintf(buffer, L"%u", value.HighPart);
|
_snwprintf_s(buffer, _TRUNCATE, L"%u", value.HighPart);
|
||||||
WritePrivateProfileString(L"Statistics", buffer2, buffer, iniFile.c_str());
|
WritePrivateProfileString(L"Statistics", buffer2, buffer, iniFile.c_str());
|
||||||
|
|
||||||
wsprintf(buffer2, L"NetStatsInLow%i", i + 1);
|
_snwprintf_s(buffer2, _TRUNCATE, L"NetStatsInLow%i", (int)i + 1);
|
||||||
wsprintf(buffer, L"%u", value.LowPart);
|
_snwprintf_s(buffer, _TRUNCATE, L"%u", value.LowPart);
|
||||||
WritePrivateProfileString(L"Statistics", buffer2, buffer, iniFile.c_str());
|
WritePrivateProfileString(L"Statistics", buffer2, buffer, iniFile.c_str());
|
||||||
|
|
||||||
value.QuadPart = c_StatValues[i * 2 + 1];
|
value.QuadPart = c_StatValues[i * 2 + 1];
|
||||||
|
|
||||||
wsprintf(buffer2, L"NetStatsOutHigh%i", i + 1);
|
_snwprintf_s(buffer2, _TRUNCATE, L"NetStatsOutHigh%i", (int)i + 1);
|
||||||
wsprintf(buffer, L"%u", value.HighPart);
|
_snwprintf_s(buffer, _TRUNCATE, L"%u", value.HighPart);
|
||||||
WritePrivateProfileString(L"Statistics", buffer2, buffer, iniFile.c_str());
|
WritePrivateProfileString(L"Statistics", buffer2, buffer, iniFile.c_str());
|
||||||
|
|
||||||
wsprintf(buffer2, L"NetStatsOutLow%i", i + 1);
|
_snwprintf_s(buffer2, _TRUNCATE, L"NetStatsOutLow%i", (int)i + 1);
|
||||||
wsprintf(buffer, L"%u", value.LowPart);
|
_snwprintf_s(buffer, _TRUNCATE, L"%u", value.LowPart);
|
||||||
WritePrivateProfileString(L"Statistics", buffer2, buffer, iniFile.c_str());
|
WritePrivateProfileString(L"Statistics", buffer2, buffer, iniFile.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ void CMeasurePlugin::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
|||||||
{
|
{
|
||||||
if (CRainmeter::GetDebug())
|
if (CRainmeter::GetDebug())
|
||||||
{
|
{
|
||||||
DebugLog(L"Plugin: Unable to load plugin: \"%s\", ErrorCode=%i", m_PluginName.c_str(), err);
|
DebugLog(L"Plugin: Unable to load plugin: \"%s\", ErrorCode=%u", m_PluginName.c_str(), err);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to load from Rainmeter's folder
|
// Try to load from Rainmeter's folder
|
||||||
@ -149,7 +149,7 @@ void CMeasurePlugin::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
|||||||
{
|
{
|
||||||
if (CRainmeter::GetDebug())
|
if (CRainmeter::GetDebug())
|
||||||
{
|
{
|
||||||
DebugLog(L"Plugin: Unable to load plugin: \"%s\", ErrorCode=%i", pluginName.c_str(), err);
|
DebugLog(L"Plugin: Unable to load plugin: \"%s\", ErrorCode=%u", pluginName.c_str(), err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -264,11 +264,11 @@ void CMeasureTime::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
|||||||
TIME_ZONE_INFORMATION tzi;
|
TIME_ZONE_INFORMATION tzi;
|
||||||
GetTimeZoneInformation(&tzi);
|
GetTimeZoneInformation(&tzi);
|
||||||
|
|
||||||
m_DeltaTime.QuadPart = (LONGLONG)((zone * 3600) - tzi.DaylightBias * 60) * 10000000.0;
|
m_DeltaTime.QuadPart = (LONGLONG)((zone * 3600) - tzi.DaylightBias * 60) * 10000000;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_DeltaTime.QuadPart = (LONGLONG)(zone * 3600) * 10000000.0;
|
m_DeltaTime.QuadPart = (LONGLONG)(zone * 3600) * 10000000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -584,7 +584,7 @@ void CMeter::ReadMeasureNames(CConfigParser& parser, const WCHAR* section, std::
|
|||||||
bool loop = true;
|
bool loop = true;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
swprintf(tmpName, L"MeasureName%i", i);
|
_snwprintf_s(tmpName, _TRUNCATE, L"MeasureName%i", i);
|
||||||
std::wstring measure = parser.ReadString(section, tmpName, L"");
|
std::wstring measure = parser.ReadString(section, tmpName, L"");
|
||||||
if (!measure.empty())
|
if (!measure.empty())
|
||||||
{
|
{
|
||||||
@ -614,7 +614,7 @@ bool CMeter::ReplaceMeasures(const std::vector<std::wstring>& stringValues, std:
|
|||||||
// Create the actual text (i.e. replace %1, %2, .. with the measure texts)
|
// Create the actual text (i.e. replace %1, %2, .. with the measure texts)
|
||||||
for (size_t i = stringValues.size(); i > 0; --i)
|
for (size_t i = stringValues.size(); i > 0; --i)
|
||||||
{
|
{
|
||||||
wsprintf(buffer, L"%%%i", i);
|
_snwprintf_s(buffer, _TRUNCATE, L"%%%i", (int)i);
|
||||||
|
|
||||||
size_t start = 0;
|
size_t start = 0;
|
||||||
size_t pos = std::wstring::npos;
|
size_t pos = std::wstring::npos;
|
||||||
|
@ -385,7 +385,7 @@ bool CMeterBitmap::Draw(Graphics& graphics)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DebugLog(L"[%i] Value: %f Frame: %i (Transition = %s)", GetTickCount(), m_Value, frame, m_TransitionStartTicks > 0 ? L"true" : L"false");
|
// DebugLog(L"[%u] Value: %f Frame: %i (Transition = %s)", GetTickCount(), m_Value, frame, m_TransitionStartTicks > 0 ? L"true" : L"false");
|
||||||
|
|
||||||
if(bitmap->GetHeight() > bitmap->GetWidth())
|
if(bitmap->GetHeight() > bitmap->GetWidth())
|
||||||
{
|
{
|
||||||
@ -451,7 +451,7 @@ bool CMeterBitmap::Draw(Graphics& graphics)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DebugLog(L"[%i] Value: %f Frame: %i (Transition = %s)", GetTickCount(), m_Value, frame, m_TransitionStartTicks > 0 ? L"true" : L"false");
|
// DebugLog(L"[%u] Value: %f Frame: %i (Transition = %s)", GetTickCount(), m_Value, frame, m_TransitionStartTicks > 0 ? L"true" : L"false");
|
||||||
|
|
||||||
if(bitmap->GetHeight() > bitmap->GetWidth())
|
if(bitmap->GetHeight() > bitmap->GetWidth())
|
||||||
{
|
{
|
||||||
|
@ -114,22 +114,22 @@ void CMeterLine::ReadConfig(const WCHAR* section)
|
|||||||
{
|
{
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
wcscpy(tmpName, L"LineColor");
|
wcsncpy_s(tmpName, L"LineColor", _TRUNCATE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
swprintf(tmpName, L"LineColor%i", i + 1);
|
_snwprintf_s(tmpName, _TRUNCATE, L"LineColor%i", i + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Colors.push_back(parser.ReadColor(section, tmpName, Color::White));
|
m_Colors.push_back(parser.ReadColor(section, tmpName, Color::White));
|
||||||
|
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
wcscpy(tmpName, L"Scale");
|
wcsncpy_s(tmpName, L"Scale", _TRUNCATE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
swprintf(tmpName, L"Scale%i", i + 1);
|
_snwprintf_s(tmpName, _TRUNCATE, L"Scale%i", i + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ScaleValues.push_back(parser.ReadFloat(section, tmpName, 1.0));
|
m_ScaleValues.push_back(parser.ReadFloat(section, tmpName, 1.0));
|
||||||
@ -138,7 +138,7 @@ void CMeterLine::ReadConfig(const WCHAR* section)
|
|||||||
{
|
{
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
{
|
{
|
||||||
swprintf(tmpName, L"MeasureName%i", i + 1);
|
_snwprintf_s(tmpName, _TRUNCATE, L"MeasureName%i", i + 1);
|
||||||
m_MeasureNames.push_back(parser.ReadString(section, tmpName, L""));
|
m_MeasureNames.push_back(parser.ReadString(section, tmpName, L""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -673,7 +673,7 @@ void CMeterString::FreeFontCache()
|
|||||||
std::wstring CMeterString::FontPropertiesToString(FontFamily* fontFamily, REAL size, FontStyle style)
|
std::wstring CMeterString::FontPropertiesToString(FontFamily* fontFamily, REAL size, FontStyle style)
|
||||||
{
|
{
|
||||||
WCHAR ids[128] = {0};
|
WCHAR ids[128] = {0};
|
||||||
swprintf(ids, L"%.1f-%i", size, (int)style);
|
_snwprintf_s(ids, _TRUNCATE, L"%.1f-%i", size, (int)style);
|
||||||
|
|
||||||
if (fontFamily)
|
if (fontFamily)
|
||||||
{
|
{
|
||||||
|
@ -940,8 +940,8 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
|
|||||||
// Formula read fine
|
// Formula read fine
|
||||||
if(result != -1)
|
if(result != -1)
|
||||||
{
|
{
|
||||||
TCHAR buffer[256];
|
WCHAR buffer[256];
|
||||||
swprintf(buffer, L"%f", value);
|
_snwprintf_s(buffer, _TRUNCATE, L"%f", value);
|
||||||
|
|
||||||
const std::wstring& resultString = buffer;
|
const std::wstring& resultString = buffer;
|
||||||
|
|
||||||
@ -1457,19 +1457,19 @@ void CMeterWindow::ScreenToWindow()
|
|||||||
if (m_WindowXPercentage == true)
|
if (m_WindowXPercentage == true)
|
||||||
{
|
{
|
||||||
num = 100.0f * (float)pixel / (float)screenw;
|
num = 100.0f * (float)pixel / (float)screenw;
|
||||||
swprintf(buffer, L"%.5f%%", num);
|
_snwprintf_s(buffer, _TRUNCATE, L"%.5f%%", num);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wsprintf(buffer, L"%i", pixel);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", pixel);
|
||||||
}
|
}
|
||||||
if (m_WindowXFromRight == true)
|
if (m_WindowXFromRight == true)
|
||||||
{
|
{
|
||||||
wsprintf(buffer, L"%sR", buffer);
|
_snwprintf_s(buffer, _TRUNCATE, L"%sR", buffer);
|
||||||
}
|
}
|
||||||
if (m_WindowXScreenDefined == true)
|
if (m_WindowXScreenDefined == true)
|
||||||
{
|
{
|
||||||
wsprintf(buffer, L"%s@%i", buffer, m_WindowXScreen);
|
_snwprintf_s(buffer, _TRUNCATE, L"%s@%i", buffer, m_WindowXScreen);
|
||||||
}
|
}
|
||||||
m_WindowX = buffer;
|
m_WindowX = buffer;
|
||||||
|
|
||||||
@ -1498,19 +1498,19 @@ void CMeterWindow::ScreenToWindow()
|
|||||||
if (m_WindowYPercentage == true)
|
if (m_WindowYPercentage == true)
|
||||||
{
|
{
|
||||||
num = 100.0f * (float)pixel / (float)screenh;
|
num = 100.0f * (float)pixel / (float)screenh;
|
||||||
swprintf(buffer, L"%.5f%%", num);
|
_snwprintf_s(buffer, _TRUNCATE, L"%.5f%%", num);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wsprintf(buffer, L"%i", pixel);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", pixel);
|
||||||
}
|
}
|
||||||
if (m_WindowYFromBottom == true)
|
if (m_WindowYFromBottom == true)
|
||||||
{
|
{
|
||||||
wsprintf(buffer, L"%sB", buffer);
|
_snwprintf_s(buffer, _TRUNCATE, L"%sB", buffer);
|
||||||
}
|
}
|
||||||
if (m_WindowYScreenDefined == true)
|
if (m_WindowYScreenDefined == true)
|
||||||
{
|
{
|
||||||
wsprintf(buffer, L"%s@%i", buffer, m_WindowYScreen);
|
_snwprintf_s(buffer, _TRUNCATE, L"%s@%i", buffer, m_WindowYScreen);
|
||||||
}
|
}
|
||||||
m_WindowY = buffer;
|
m_WindowY = buffer;
|
||||||
}
|
}
|
||||||
@ -1575,14 +1575,14 @@ void CMeterWindow::ReadConfig()
|
|||||||
{
|
{
|
||||||
double value = parser.ReadFormula(section, L"WindowX", 0.0);
|
double value = parser.ReadFormula(section, L"WindowX", 0.0);
|
||||||
WCHAR buffer[32];
|
WCHAR buffer[32];
|
||||||
swprintf(buffer, L"%i", (int)value);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", (int)value);
|
||||||
m_WindowX = buffer;
|
m_WindowX = buffer;
|
||||||
}
|
}
|
||||||
if (!m_WindowY.empty() && m_WindowY[0] == L'(' && m_WindowY[m_WindowY.size() - 1] == L')')
|
if (!m_WindowY.empty() && m_WindowY[0] == L'(' && m_WindowY[m_WindowY.size() - 1] == L')')
|
||||||
{
|
{
|
||||||
double value = parser.ReadFormula(section, L"WindowY", 0.0);
|
double value = parser.ReadFormula(section, L"WindowY", 0.0);
|
||||||
WCHAR buffer[32];
|
WCHAR buffer[32];
|
||||||
swprintf(buffer, L"%i", (int)value);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", (int)value);
|
||||||
m_WindowY = buffer;
|
m_WindowY = buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1663,28 +1663,28 @@ void CMeterWindow::WriteConfig()
|
|||||||
WritePrivateProfileString(section, L"WindowY", m_WindowY.c_str(), iniFile.c_str());
|
WritePrivateProfileString(section, L"WindowY", m_WindowY.c_str(), iniFile.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
wsprintf(buffer, L"%i", m_AlphaValue);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_AlphaValue);
|
||||||
WritePrivateProfileString(section, L"AlphaValue", buffer, iniFile.c_str());
|
WritePrivateProfileString(section, L"AlphaValue", buffer, iniFile.c_str());
|
||||||
|
|
||||||
wsprintf(buffer, L"%i", m_FadeDuration);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_FadeDuration);
|
||||||
WritePrivateProfileString(section, L"FadeDuration", buffer, iniFile.c_str());
|
WritePrivateProfileString(section, L"FadeDuration", buffer, iniFile.c_str());
|
||||||
|
|
||||||
wsprintf(buffer, L"%i", m_ClickThrough);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_ClickThrough);
|
||||||
WritePrivateProfileString(section, L"ClickThrough", buffer, iniFile.c_str());
|
WritePrivateProfileString(section, L"ClickThrough", buffer, iniFile.c_str());
|
||||||
wsprintf(buffer, L"%i", m_WindowDraggable);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_WindowDraggable);
|
||||||
WritePrivateProfileString(section, L"Draggable", buffer, iniFile.c_str());
|
WritePrivateProfileString(section, L"Draggable", buffer, iniFile.c_str());
|
||||||
wsprintf(buffer, L"%i", m_WindowHide);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_WindowHide);
|
||||||
WritePrivateProfileString(section, L"HideOnMouseOver", buffer, iniFile.c_str());
|
WritePrivateProfileString(section, L"HideOnMouseOver", buffer, iniFile.c_str());
|
||||||
wsprintf(buffer, L"%i", m_SavePosition);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_SavePosition);
|
||||||
WritePrivateProfileString(section, L"SavePosition", buffer, iniFile.c_str());
|
WritePrivateProfileString(section, L"SavePosition", buffer, iniFile.c_str());
|
||||||
wsprintf(buffer, L"%i", m_SnapEdges);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_SnapEdges);
|
||||||
WritePrivateProfileString(section, L"SnapEdges", buffer, iniFile.c_str());
|
WritePrivateProfileString(section, L"SnapEdges", buffer, iniFile.c_str());
|
||||||
wsprintf(buffer, L"%i", m_KeepOnScreen);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_KeepOnScreen);
|
||||||
WritePrivateProfileString(section, L"KeepOnScreen", buffer, iniFile.c_str());
|
WritePrivateProfileString(section, L"KeepOnScreen", buffer, iniFile.c_str());
|
||||||
wsprintf(buffer, L"%i", m_AutoSelectScreen);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_AutoSelectScreen);
|
||||||
WritePrivateProfileString(section, L"AutoSelectScreen", buffer, iniFile.c_str());
|
WritePrivateProfileString(section, L"AutoSelectScreen", buffer, iniFile.c_str());
|
||||||
|
|
||||||
wsprintf(buffer, L"%i", m_WindowZPosition);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_WindowZPosition);
|
||||||
WritePrivateProfileString(section, L"AlwaysOnTop", buffer, iniFile.c_str());
|
WritePrivateProfileString(section, L"AlwaysOnTop", buffer, iniFile.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1732,11 +1732,11 @@ bool CMeterWindow::ReadSkin()
|
|||||||
WCHAR buffer[128];
|
WCHAR buffer[128];
|
||||||
if (appVersion % 1000 != 0)
|
if (appVersion % 1000 != 0)
|
||||||
{
|
{
|
||||||
wsprintf(buffer, L"%i.%i.%i", appVersion / 1000000, (appVersion / 1000) % 1000, appVersion % 1000);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i.%i.%i", appVersion / 1000000, (appVersion / 1000) % 1000, appVersion % 1000);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wsprintf(buffer, L"%i.%i", appVersion / 1000000, (appVersion / 1000) % 1000);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i.%i", appVersion / 1000000, (appVersion / 1000) % 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring text = L"The skin \"" + m_SkinName;
|
std::wstring text = L"The skin \"" + m_SkinName;
|
||||||
@ -1838,7 +1838,7 @@ bool CMeterWindow::ReadSkin()
|
|||||||
bool loop = true;
|
bool loop = true;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
swprintf(tmpName, L"LocalFont%i", i);
|
_snwprintf_s(tmpName, _TRUNCATE, L"LocalFont%i", i);
|
||||||
localFont = m_Parser.ReadString(L"Rainmeter", tmpName, L"");
|
localFont = m_Parser.ReadString(L"Rainmeter", tmpName, L"");
|
||||||
// There is a key called LocalFont%i
|
// There is a key called LocalFont%i
|
||||||
if (!localFont.empty())
|
if (!localFont.empty())
|
||||||
|
@ -191,6 +191,169 @@ LPCTSTR ReadConfigString(LPCTSTR section, LPCTSTR key, LPCTSTR defValue)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** PluginBridge
|
||||||
|
**
|
||||||
|
** Receives a command and data from a plugin and returns a result. Used by plugins.
|
||||||
|
**
|
||||||
|
** Revision history:
|
||||||
|
** 2010.12.13 Peter Souza IV / psouza4 initial creation
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
LPCTSTR PluginBridge(LPCTSTR _sCommand, LPCTSTR _sData)
|
||||||
|
{
|
||||||
|
if (Rainmeter)
|
||||||
|
{
|
||||||
|
static std::wstring result;
|
||||||
|
|
||||||
|
if (_sCommand == NULL) _sCommand = L"";
|
||||||
|
if (_sData == NULL) _sData = L"";
|
||||||
|
|
||||||
|
std::wstring sCommand = _sCommand;
|
||||||
|
std::wstring sData = _sData;
|
||||||
|
std::transform(sCommand.begin(), sCommand.end(), sCommand.begin(), ::towlower);
|
||||||
|
|
||||||
|
// Command GetConfig
|
||||||
|
// Data unquoted full path and filename given to the plugin on initialize
|
||||||
|
// (note: this is CaSe-SeNsItIvE!)
|
||||||
|
// Execution none
|
||||||
|
// Result the config name if found or a blank string if not
|
||||||
|
if (sCommand == L"getconfig")
|
||||||
|
{
|
||||||
|
// returns the config name, lookup by INI file
|
||||||
|
|
||||||
|
CMeterWindow *meterWindow = Rainmeter->GetMeterWindowByINI(sData);
|
||||||
|
if (meterWindow)
|
||||||
|
{
|
||||||
|
result = meterWindow->GetSkinName();
|
||||||
|
return result.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
return L"";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Command SkinAuthor
|
||||||
|
// Data the config name
|
||||||
|
// Execution none
|
||||||
|
// Result the skin author of the skin name or 'error' if the config name
|
||||||
|
// was not found
|
||||||
|
if (sCommand == L"skinauthor")
|
||||||
|
{
|
||||||
|
std::vector<std::wstring> subStrings = CRainmeter::ParseString(_sData);
|
||||||
|
|
||||||
|
if (subStrings.size() >= 1)
|
||||||
|
{
|
||||||
|
std::wstring config = subStrings[0];
|
||||||
|
|
||||||
|
CMeterWindow *meterWindow = Rainmeter->GetMeterWindow(config);
|
||||||
|
if (meterWindow)
|
||||||
|
{
|
||||||
|
result = meterWindow->GetSkinAuthor();
|
||||||
|
return result.c_str();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return L"error";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Command GetVariable
|
||||||
|
// Data [the config name]
|
||||||
|
// Execution none
|
||||||
|
// Result the value of the variable
|
||||||
|
if (sCommand == L"getvariable")
|
||||||
|
{
|
||||||
|
std::vector<std::wstring> subStrings = CRainmeter::ParseString(_sData);
|
||||||
|
|
||||||
|
if (subStrings.size() >= 2)
|
||||||
|
{
|
||||||
|
std::wstring config = subStrings[0];
|
||||||
|
|
||||||
|
CMeterWindow *meterWindow = Rainmeter->GetMeterWindow(config);
|
||||||
|
if (meterWindow)
|
||||||
|
{
|
||||||
|
std::wstring variable = subStrings[1];
|
||||||
|
std::wstring result_from_parser;
|
||||||
|
|
||||||
|
if (meterWindow->GetParser().GetVariable(variable, result_from_parser))
|
||||||
|
{
|
||||||
|
result = result_from_parser;
|
||||||
|
return result.c_str();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return L"";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Command SetVariable
|
||||||
|
// Data [the config name] [variable data]
|
||||||
|
// Execution the indicated variable is updated
|
||||||
|
// Result 'success' if the config was found, 'error' otherwise
|
||||||
|
if (sCommand == L"setvariable")
|
||||||
|
{
|
||||||
|
std::vector<std::wstring> subStrings = CRainmeter::ParseString(_sData);
|
||||||
|
|
||||||
|
if (subStrings.size() >= 2)
|
||||||
|
{
|
||||||
|
std::wstring config = subStrings[0];
|
||||||
|
std::wstring arguments;
|
||||||
|
|
||||||
|
for (size_t i = 1; i < subStrings.size(); ++i)
|
||||||
|
{
|
||||||
|
if (i != 1) arguments += L" ";
|
||||||
|
arguments += subStrings[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
CMeterWindow *meterWindow = Rainmeter->GetMeterWindow(config);
|
||||||
|
if (meterWindow)
|
||||||
|
{
|
||||||
|
meterWindow->RunBang(BANG_SETVARIABLE, arguments.c_str());
|
||||||
|
return L"success";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
result = L"er1/";
|
||||||
|
result += subStrings[0];
|
||||||
|
result += L"/";
|
||||||
|
TCHAR x[100];
|
||||||
|
_snwprintf_s(x, _TRUNCATE, L"%d", subStrings.size());
|
||||||
|
result += x;
|
||||||
|
return result.c_str();
|
||||||
|
*/
|
||||||
|
return L"error";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Command GetWindow
|
||||||
|
// Data [the config name]
|
||||||
|
// Execution none
|
||||||
|
// Result the HWND to the specified config window if found, 'error' otherwise
|
||||||
|
if (sCommand == L"getwindow")
|
||||||
|
{
|
||||||
|
std::vector<std::wstring> subStrings = CRainmeter::ParseString(_sData);
|
||||||
|
|
||||||
|
if (subStrings.size() >= 1)
|
||||||
|
{
|
||||||
|
std::wstring config = subStrings[0];
|
||||||
|
|
||||||
|
CMeterWindow *meterWindow = Rainmeter->GetMeterWindow(config);
|
||||||
|
if (meterWindow)
|
||||||
|
{
|
||||||
|
TCHAR buf1[100];
|
||||||
|
_snwprintf_s(buf1, _TRUNCATE, L"%lu", meterWindow->GetWindow());
|
||||||
|
result = buf1;
|
||||||
|
return result.c_str();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return L"error";
|
||||||
|
}
|
||||||
|
|
||||||
|
return L"noop";
|
||||||
|
}
|
||||||
|
|
||||||
|
return L"error:no rainmeter!";
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** BangWithArgs
|
** BangWithArgs
|
||||||
**
|
**
|
||||||
@ -487,11 +650,11 @@ void RainmeterActivateConfig(HWND, const char* arg)
|
|||||||
{
|
{
|
||||||
const std::vector<CRainmeter::CONFIG>& configs = Rainmeter->GetAllConfigs();
|
const std::vector<CRainmeter::CONFIG>& configs = Rainmeter->GetAllConfigs();
|
||||||
|
|
||||||
for (size_t i = 0; i < configs.size(); ++i)
|
for (int i = 0; i < (int)configs.size(); ++i)
|
||||||
{
|
{
|
||||||
if (_wcsicmp(configs[i].config.c_str(), subStrings[0].c_str()) == 0)
|
if (_wcsicmp(configs[i].config.c_str(), subStrings[0].c_str()) == 0)
|
||||||
{
|
{
|
||||||
for (size_t j = 0; j < configs[i].iniFiles.size(); ++j)
|
for (int j = 0; j < (int)configs[i].iniFiles.size(); ++j)
|
||||||
{
|
{
|
||||||
if (_wcsicmp(configs[i].iniFiles[j].c_str(), subStrings[1].c_str()) == 0)
|
if (_wcsicmp(configs[i].iniFiles[j].c_str(), subStrings[1].c_str()) == 0)
|
||||||
{
|
{
|
||||||
@ -1039,8 +1202,11 @@ void RainmeterWriteKeyValue(HWND, const char* arg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_wcsnicmp(iniFile.c_str(), Rainmeter->GetSkinPath().c_str(), Rainmeter->GetSkinPath().size()) != 0 &&
|
const std::wstring& skinPath = Rainmeter->GetSkinPath();
|
||||||
_wcsnicmp(iniFile.c_str(), Rainmeter->GetPath().c_str(), Rainmeter->GetPath().size()) != 0)
|
const std::wstring settingsPath = Rainmeter->GetSettingsPath();
|
||||||
|
|
||||||
|
if (_wcsnicmp(iniFile.c_str(), skinPath.c_str(), skinPath.size()) != 0 &&
|
||||||
|
_wcsnicmp(iniFile.c_str(), settingsPath.c_str(), settingsPath.size()) != 0)
|
||||||
{
|
{
|
||||||
DebugLog(L"!RainmeterWriteKeyValue: Illegal path outside of Rainmeter directories: %s", iniFile.c_str());
|
DebugLog(L"!RainmeterWriteKeyValue: Illegal path outside of Rainmeter directories: %s", iniFile.c_str());
|
||||||
return;
|
return;
|
||||||
@ -1101,8 +1267,8 @@ void RainmeterWriteKeyValue(HWND, const char* arg)
|
|||||||
// Formula read fine
|
// Formula read fine
|
||||||
if (formula != -1)
|
if (formula != -1)
|
||||||
{
|
{
|
||||||
TCHAR buffer[256];
|
WCHAR buffer[256];
|
||||||
swprintf(buffer, L"%f", value);
|
_snwprintf_s(buffer, _TRUNCATE, L"%f", value);
|
||||||
|
|
||||||
const std::wstring& resultString = buffer;
|
const std::wstring& resultString = buffer;
|
||||||
|
|
||||||
@ -1916,7 +2082,7 @@ bool CRainmeter::DeactivateConfig(CMeterWindow* meterWindow, int configIndex)
|
|||||||
void CRainmeter::WriteActive(const std::wstring& config, int iniIndex)
|
void CRainmeter::WriteActive(const std::wstring& config, int iniIndex)
|
||||||
{
|
{
|
||||||
WCHAR buffer[32];
|
WCHAR buffer[32];
|
||||||
wsprintf(buffer, L"%i", iniIndex + 1);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", iniIndex + 1);
|
||||||
WritePrivateProfileString(config.c_str(), L"Active", buffer, m_IniFile.c_str());
|
WritePrivateProfileString(config.c_str(), L"Active", buffer, m_IniFile.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2026,11 +2192,10 @@ CMeterWindow* CRainmeter::GetMeterWindowByINI(const std::wstring& ini_searching)
|
|||||||
|
|
||||||
for (; iter != m_Meters.end(); ++iter)
|
for (; iter != m_Meters.end(); ++iter)
|
||||||
{
|
{
|
||||||
std::wstring ini_current = L"";
|
std::wstring ini_current = (*iter).second->GetSkinPath();
|
||||||
ini_current += ((*iter).second->GetSkinPath()); // includes trailing backslash
|
ini_current += (*iter).second->GetSkinName();
|
||||||
ini_current += ((*iter).second->GetSkinName());
|
|
||||||
ini_current += L"\\";
|
ini_current += L"\\";
|
||||||
ini_current += ((*iter).second->GetSkinIniFile());
|
ini_current += (*iter).second->GetSkinIniFile();
|
||||||
|
|
||||||
if (_wcsicmp(ini_current.c_str(), ini_searching.c_str()) == 0)
|
if (_wcsicmp(ini_current.c_str(), ini_searching.c_str()) == 0)
|
||||||
{
|
{
|
||||||
@ -2872,7 +3037,7 @@ void CRainmeter::ReadGeneralSettings(const std::wstring& iniFile)
|
|||||||
for (UINT i = 1; i <= CSystem::GetMonitorCount(); ++i)
|
for (UINT i = 1; i <= CSystem::GetMonitorCount(); ++i)
|
||||||
{
|
{
|
||||||
WCHAR buffer[64];
|
WCHAR buffer[64];
|
||||||
wsprintf(buffer, L"DesktopWorkArea@%i", i);
|
_snwprintf_s(buffer, _TRUNCATE, L"DesktopWorkArea@%i", i);
|
||||||
area = parser.ReadString(L"Rainmeter", buffer, L"");
|
area = parser.ReadString(L"Rainmeter", buffer, L"");
|
||||||
if (!area.empty())
|
if (!area.empty())
|
||||||
{
|
{
|
||||||
@ -2915,7 +3080,7 @@ void CRainmeter::ReadGeneralSettings(const std::wstring& iniFile)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < m_ConfigStrings.size(); ++i)
|
for (int i = 0; i < (int)m_ConfigStrings.size(); ++i)
|
||||||
{
|
{
|
||||||
int active = parser.ReadInt(m_ConfigStrings[i].config.c_str(), L"Active", 0);
|
int active = parser.ReadInt(m_ConfigStrings[i].config.c_str(), L"Active", 0);
|
||||||
|
|
||||||
@ -2936,13 +3101,13 @@ void CRainmeter::ReadGeneralSettings(const std::wstring& iniFile)
|
|||||||
*/
|
*/
|
||||||
bool CRainmeter::SetActiveConfig(const std::wstring& skinName, const std::wstring& skinIni)
|
bool CRainmeter::SetActiveConfig(const std::wstring& skinName, const std::wstring& skinIni)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < m_ConfigStrings.size(); ++i)
|
for (int i = 0; i < (int)m_ConfigStrings.size(); ++i)
|
||||||
{
|
{
|
||||||
m_ConfigStrings[i].active = 0; // Disable all other configs
|
m_ConfigStrings[i].active = 0; // Disable all other configs
|
||||||
|
|
||||||
if (skinName == m_ConfigStrings[i].config)
|
if (skinName == m_ConfigStrings[i].config)
|
||||||
{
|
{
|
||||||
for (size_t j = 0; j < m_ConfigStrings[i].iniFiles.size(); ++j)
|
for (int j = 0; j < (int)m_ConfigStrings[i].iniFiles.size(); ++j)
|
||||||
{
|
{
|
||||||
if (skinIni == m_ConfigStrings[i].iniFiles[j])
|
if (skinIni == m_ConfigStrings[i].iniFiles[j])
|
||||||
{
|
{
|
||||||
@ -2991,13 +3156,13 @@ void CRainmeter::RefreshAll()
|
|||||||
// Verify whether the cached information is valid
|
// Verify whether the cached information is valid
|
||||||
int found = 0;
|
int found = 0;
|
||||||
std::wstring skinConfig = mw->GetSkinName();
|
std::wstring skinConfig = mw->GetSkinName();
|
||||||
for (size_t i = 0; i < m_ConfigStrings.size(); ++i)
|
for (int i = 0; i < (int)m_ConfigStrings.size(); ++i)
|
||||||
{
|
{
|
||||||
if (_wcsicmp(skinConfig.c_str(), m_ConfigStrings[i].config.c_str()) == 0)
|
if (_wcsicmp(skinConfig.c_str(), m_ConfigStrings[i].config.c_str()) == 0)
|
||||||
{
|
{
|
||||||
found = 1;
|
found = 1;
|
||||||
std::wstring skinIniFile = mw->GetSkinIniFile();
|
std::wstring skinIniFile = mw->GetSkinIniFile();
|
||||||
for (size_t j = 0; j < m_ConfigStrings[i].iniFiles.size(); ++j)
|
for (int j = 0; j < (int)m_ConfigStrings[i].iniFiles.size(); ++j)
|
||||||
{
|
{
|
||||||
if (_wcsicmp(skinIniFile.c_str(), m_ConfigStrings[i].iniFiles[j].c_str()) == 0)
|
if (_wcsicmp(skinIniFile.c_str(), m_ConfigStrings[i].iniFiles[j].c_str()) == 0)
|
||||||
{
|
{
|
||||||
@ -3080,7 +3245,7 @@ void CRainmeter::UpdateDesktopWorkArea(bool reset)
|
|||||||
{
|
{
|
||||||
format += L" => FAIL.";
|
format += L" => FAIL.";
|
||||||
}
|
}
|
||||||
DebugLog(format.c_str(), i + 1, r.left, r.top, r.right, r.bottom, r.right - r.left, r.bottom - r.top);
|
DebugLog(format.c_str(), (int)i + 1, r.left, r.top, r.right, r.bottom, r.right - r.left, r.bottom - r.top);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
changed = true;
|
changed = true;
|
||||||
@ -3094,7 +3259,7 @@ void CRainmeter::UpdateDesktopWorkArea(bool reset)
|
|||||||
if (m_OldDesktopWorkAreas.empty())
|
if (m_OldDesktopWorkAreas.empty())
|
||||||
{
|
{
|
||||||
// Store old work areas for changing them back
|
// Store old work areas for changing them back
|
||||||
for (UINT i = 0; i < CSystem::GetMonitorCount(); ++i)
|
for (size_t i = 0; i < CSystem::GetMonitorCount(); ++i)
|
||||||
{
|
{
|
||||||
m_OldDesktopWorkAreas.push_back(monitors[i].work);
|
m_OldDesktopWorkAreas.push_back(monitors[i].work);
|
||||||
}
|
}
|
||||||
@ -3146,7 +3311,7 @@ void CRainmeter::UpdateDesktopWorkArea(bool reset)
|
|||||||
if (i != 0)
|
if (i != 0)
|
||||||
{
|
{
|
||||||
WCHAR buffer[64];
|
WCHAR buffer[64];
|
||||||
wsprintf(buffer, L"@%i", i);
|
_snwprintf_s(buffer, _TRUNCATE, L"@%i", i);
|
||||||
format += buffer;
|
format += buffer;
|
||||||
}
|
}
|
||||||
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)";
|
||||||
@ -3400,7 +3565,7 @@ HMENU CRainmeter::CreateConfigMenu(std::vector<CONFIGMENU>& configMenuData)
|
|||||||
{
|
{
|
||||||
configMenu = CreatePopupMenu();
|
configMenu = CreatePopupMenu();
|
||||||
|
|
||||||
for (size_t i = 0; i < configMenuData.size(); ++i)
|
for (int i = 0; i < (int)configMenuData.size(); ++i)
|
||||||
{
|
{
|
||||||
if (configMenuData[i].index == -1)
|
if (configMenuData[i].index == -1)
|
||||||
{
|
{
|
||||||
@ -3587,13 +3752,13 @@ HMENU CRainmeter::CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU con
|
|||||||
ChangeSkinIndex(skinMenu, index);
|
ChangeSkinIndex(skinMenu, index);
|
||||||
|
|
||||||
// Add the variants menu
|
// Add the variants menu
|
||||||
for (size_t i = 0; i < m_ConfigStrings.size(); ++i)
|
for (int i = 0; i < (int)m_ConfigStrings.size(); ++i)
|
||||||
{
|
{
|
||||||
const CONFIG& config = m_ConfigStrings[i];
|
const CONFIG& config = m_ConfigStrings[i];
|
||||||
if (_wcsicmp(config.config.c_str(), skinName.c_str()) == 0)
|
if (_wcsicmp(config.config.c_str(), skinName.c_str()) == 0)
|
||||||
{
|
{
|
||||||
HMENU variantsMenu = CreatePopupMenu();
|
HMENU variantsMenu = CreatePopupMenu();
|
||||||
for (size_t j = 0; j < config.iniFiles.size(); ++j)
|
for (int j = 0; j < (int)config.iniFiles.size(); ++j)
|
||||||
{
|
{
|
||||||
InsertMenu(variantsMenu, j, MF_BYPOSITION, config.commands[j], config.iniFiles[j].c_str());
|
InsertMenu(variantsMenu, j, MF_BYPOSITION, config.commands[j], config.iniFiles[j].c_str());
|
||||||
|
|
||||||
@ -3656,10 +3821,10 @@ void CRainmeter::CreateMonitorMenu(HMENU monitorMenu, CMeterWindow* meterWindow)
|
|||||||
const MULTIMONITOR_INFO& multimonInfo = CSystem::GetMultiMonitorInfo();
|
const MULTIMONITOR_INFO& multimonInfo = CSystem::GetMultiMonitorInfo();
|
||||||
const std::vector<MONITOR_INFO>& monitors = multimonInfo.monitors;
|
const std::vector<MONITOR_INFO>& monitors = multimonInfo.monitors;
|
||||||
|
|
||||||
for (size_t i = 0; i < monitors.size(); ++i)
|
for (int i = 0; i < (int)monitors.size(); ++i)
|
||||||
{
|
{
|
||||||
WCHAR buffer[64];
|
WCHAR buffer[64];
|
||||||
wsprintf(buffer, L"@%i: ", i + 1);
|
_snwprintf_s(buffer, _TRUNCATE, L"@%i: ", i + 1);
|
||||||
std::wstring item = buffer;
|
std::wstring item = buffer;
|
||||||
|
|
||||||
size_t len = wcslen(monitors[i].monitorName);
|
size_t len = wcslen(monitors[i].monitorName);
|
||||||
@ -3676,7 +3841,7 @@ void CRainmeter::CreateMonitorMenu(HMENU monitorMenu, CMeterWindow* meterWindow)
|
|||||||
UINT pos = i + 3;
|
UINT pos = i + 3;
|
||||||
InsertMenu(monitorMenu, pos, MF_BYPOSITION, ID_MONITOR_FIRST + i + 1, item.c_str());
|
InsertMenu(monitorMenu, pos, MF_BYPOSITION, ID_MONITOR_FIRST + i + 1, item.c_str());
|
||||||
|
|
||||||
if (screenDefined && screenIndex == (int)i + 1)
|
if (screenDefined && screenIndex == i + 1)
|
||||||
{
|
{
|
||||||
CheckMenuItem(monitorMenu, pos, MF_BYPOSITION | MF_CHECKED);
|
CheckMenuItem(monitorMenu, pos, MF_BYPOSITION | MF_CHECKED);
|
||||||
}
|
}
|
||||||
@ -3909,168 +4074,3 @@ void CRainmeter::ExpandEnvironmentVariables(std::wstring& strPath)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
** PluginBridge
|
|
||||||
**
|
|
||||||
** Receives a command and data from a plugin and returns a result. Used by plugins.
|
|
||||||
**
|
|
||||||
** Revision history:
|
|
||||||
** 2010.12.13 Peter Souza IV / psouza4 initial creation
|
|
||||||
**
|
|
||||||
*/
|
|
||||||
LPCTSTR PluginBridge(LPCTSTR _sCommand, LPCTSTR _sData)
|
|
||||||
{
|
|
||||||
if (Rainmeter)
|
|
||||||
{
|
|
||||||
static std::wstring result;
|
|
||||||
std::wstring sCommand = _sCommand;
|
|
||||||
std::wstring sData = _sData;
|
|
||||||
std::transform(sCommand.begin(), sCommand.end(), sCommand.begin(), ::towlower);
|
|
||||||
|
|
||||||
// Command GetConfig
|
|
||||||
// Data unquoted full path and filename given to the plugin on initialize
|
|
||||||
// (note: this is CaSe-SeNsItIvE!)
|
|
||||||
// Execution none
|
|
||||||
// Result the config name if found or a blank string if not
|
|
||||||
if (sCommand == L"getconfig")
|
|
||||||
{
|
|
||||||
// returns the config name, lookup by INI file
|
|
||||||
|
|
||||||
CMeterWindow *meterWindow = Rainmeter->GetMeterWindowByINI(sData);
|
|
||||||
if (meterWindow)
|
|
||||||
{
|
|
||||||
result = meterWindow->GetSkinName();
|
|
||||||
return result.c_str();
|
|
||||||
}
|
|
||||||
|
|
||||||
return L"";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Command SkinAuthor
|
|
||||||
// Data the config name
|
|
||||||
// Execution none
|
|
||||||
// Result the skin author of the skin name or 'error' if the config name
|
|
||||||
// was not found
|
|
||||||
if (sCommand == L"skinauthor")
|
|
||||||
{
|
|
||||||
std::vector<std::wstring> subStrings = CRainmeter::ParseString(_sData);
|
|
||||||
std::wstring config;
|
|
||||||
|
|
||||||
if (subStrings.size() >= 1)
|
|
||||||
{
|
|
||||||
config = subStrings[0];
|
|
||||||
|
|
||||||
CMeterWindow *meterWindow = Rainmeter->GetMeterWindow(config);
|
|
||||||
if (meterWindow)
|
|
||||||
{
|
|
||||||
result = meterWindow->GetSkinAuthor();
|
|
||||||
return result.c_str();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return L"error";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Command GetVariable
|
|
||||||
// Data [the config name]
|
|
||||||
// Execution none
|
|
||||||
// Result the value of the variable
|
|
||||||
if (sCommand == L"getvariable")
|
|
||||||
{
|
|
||||||
std::vector<std::wstring> subStrings = CRainmeter::ParseString(_sData);
|
|
||||||
std::wstring config;
|
|
||||||
std::wstring variable;
|
|
||||||
|
|
||||||
if (subStrings.size() >= 2)
|
|
||||||
{
|
|
||||||
config = subStrings[0];
|
|
||||||
variable = subStrings[1];
|
|
||||||
|
|
||||||
CMeterWindow *meterWindow = Rainmeter->GetMeterWindow(config);
|
|
||||||
if (meterWindow)
|
|
||||||
{
|
|
||||||
std::wstring result_from_parser = L"";
|
|
||||||
|
|
||||||
if (meterWindow->GetParser().GetVariable(variable, result_from_parser))
|
|
||||||
{
|
|
||||||
result = result_from_parser;
|
|
||||||
return result.c_str();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return L"";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Command SetVariable
|
|
||||||
// Data [the config name] [variable data]
|
|
||||||
// Execution the indicated variable is updated
|
|
||||||
// Result 'success' if the config was found, 'error' otherwise
|
|
||||||
if (sCommand == L"setvariable")
|
|
||||||
{
|
|
||||||
std::vector<std::wstring> subStrings = CRainmeter::ParseString(_sData);
|
|
||||||
std::wstring config;
|
|
||||||
std::wstring arguments;
|
|
||||||
|
|
||||||
if (subStrings.size() >= 2)
|
|
||||||
{
|
|
||||||
config = subStrings[0];
|
|
||||||
|
|
||||||
for (size_t i = 1; i < subStrings.size(); ++i)
|
|
||||||
{
|
|
||||||
if (i != 1) arguments += L" ";
|
|
||||||
arguments += subStrings[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
CMeterWindow *meterWindow = Rainmeter->GetMeterWindow(config);
|
|
||||||
if (meterWindow)
|
|
||||||
{
|
|
||||||
meterWindow->RunBang(BANG_SETVARIABLE, arguments.c_str());
|
|
||||||
return L"success";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
result = L"er1/";
|
|
||||||
result += subStrings[0];
|
|
||||||
result += L"/";
|
|
||||||
TCHAR x[100];
|
|
||||||
swprintf(x, L"%d", subStrings.size());
|
|
||||||
result += x;
|
|
||||||
return result.c_str();
|
|
||||||
*/
|
|
||||||
return L"error";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Command GetWindow
|
|
||||||
// Data [the config name]
|
|
||||||
// Execution none
|
|
||||||
// Result the HWND to the specified config window if found, 'error' otherwise
|
|
||||||
if (sCommand == L"getwindow")
|
|
||||||
{
|
|
||||||
std::vector<std::wstring> subStrings = CRainmeter::ParseString(_sData);
|
|
||||||
std::wstring config;
|
|
||||||
|
|
||||||
if (subStrings.size() >= 1)
|
|
||||||
{
|
|
||||||
config = subStrings[0];
|
|
||||||
|
|
||||||
CMeterWindow *meterWindow = Rainmeter->GetMeterWindow(config);
|
|
||||||
if (meterWindow)
|
|
||||||
{
|
|
||||||
TCHAR buf1[100];
|
|
||||||
swprintf(buf1, L"%lu", meterWindow->GetWindow());
|
|
||||||
result = buf1;
|
|
||||||
return result.c_str();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return L"error";
|
|
||||||
}
|
|
||||||
|
|
||||||
return L"noop";
|
|
||||||
}
|
|
||||||
|
|
||||||
return L"error:no rainmeter!";
|
|
||||||
}
|
|
||||||
|
@ -173,7 +173,7 @@ BOOL CALLBACK MyInfoEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonit
|
|||||||
{
|
{
|
||||||
LSLog(LOG_DEBUG, APPNAME, info.szDevice);
|
LSLog(LOG_DEBUG, APPNAME, info.szDevice);
|
||||||
DebugLog(L" Flags : %s(0x%08X)", (info.dwFlags & MONITORINFOF_PRIMARY) ? L"PRIMARY " : L"", info.dwFlags);
|
DebugLog(L" Flags : %s(0x%08X)", (info.dwFlags & MONITORINFOF_PRIMARY) ? L"PRIMARY " : L"", info.dwFlags);
|
||||||
DebugLog(L" Handle : 0x%08X", hMonitor);
|
DebugLog(L" Handle : 0x%p", hMonitor);
|
||||||
DebugLog(L" ScrArea : L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)",
|
DebugLog(L" ScrArea : L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)",
|
||||||
lprcMonitor->left, lprcMonitor->top, lprcMonitor->right, lprcMonitor->bottom,
|
lprcMonitor->left, lprcMonitor->top, lprcMonitor->right, lprcMonitor->bottom,
|
||||||
lprcMonitor->right - lprcMonitor->left, lprcMonitor->bottom - lprcMonitor->top);
|
lprcMonitor->right - lprcMonitor->left, lprcMonitor->bottom - lprcMonitor->top);
|
||||||
@ -205,7 +205,7 @@ BOOL CALLBACK MyInfoEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonit
|
|||||||
monitor.screen = *lprcMonitor;
|
monitor.screen = *lprcMonitor;
|
||||||
monitor.work = info.rcWork;
|
monitor.work = info.rcWork;
|
||||||
|
|
||||||
wcsncpy(monitor.deviceName, info.szDevice, 32); // E.g. "\\.\DISPLAY1"
|
wcsncpy_s(monitor.deviceName, info.szDevice, _TRUNCATE); // 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 = {0};
|
DISPLAY_DEVICE ddm = {0};
|
||||||
@ -215,7 +215,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(monitor.monitorName, ddm.DeviceString, 128);
|
wcsncpy_s(monitor.monitorName, ddm.DeviceString, _TRUNCATE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -332,7 +332,7 @@ void CSystem::SetMultiMonitorInfo()
|
|||||||
MONITOR_INFO monitor = {0};
|
MONITOR_INFO monitor = {0};
|
||||||
|
|
||||||
monitor.handle = NULL;
|
monitor.handle = NULL;
|
||||||
wcsncpy(monitor.deviceName, dd.DeviceName, 32); // E.g. "\\.\DISPLAY1"
|
wcsncpy_s(monitor.deviceName, dd.DeviceName, _TRUNCATE); // 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 = {0};
|
DISPLAY_DEVICE ddm = {0};
|
||||||
@ -342,7 +342,7 @@ void CSystem::SetMultiMonitorInfo()
|
|||||||
{
|
{
|
||||||
if (ddm.StateFlags & DISPLAY_DEVICE_ACTIVE && ddm.StateFlags & DISPLAY_DEVICE_ATTACHED)
|
if (ddm.StateFlags & DISPLAY_DEVICE_ACTIVE && ddm.StateFlags & DISPLAY_DEVICE_ATTACHED)
|
||||||
{
|
{
|
||||||
wcsncpy(monitor.monitorName, ddm.DeviceString, 128);
|
wcsncpy_s(monitor.monitorName, ddm.DeviceString, _TRUNCATE);
|
||||||
|
|
||||||
if (logging)
|
if (logging)
|
||||||
{
|
{
|
||||||
@ -372,7 +372,7 @@ void CSystem::SetMultiMonitorInfo()
|
|||||||
|
|
||||||
if (logging)
|
if (logging)
|
||||||
{
|
{
|
||||||
DebugLog(L" Handle : 0x%08X", monitor.handle);
|
DebugLog(L" Handle : 0x%p", monitor.handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,7 +448,7 @@ void CSystem::SetMultiMonitorInfo()
|
|||||||
c_Monitors.useEnumDisplayMonitors = false;
|
c_Monitors.useEnumDisplayMonitors = false;
|
||||||
|
|
||||||
MONITOR_INFO monitor = {0};
|
MONITOR_INFO monitor = {0};
|
||||||
wcscpy(monitor.deviceName, L"DUMMY");
|
wcsncpy_s(monitor.deviceName, L"DUMMY", _TRUNCATE);
|
||||||
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;
|
||||||
@ -487,7 +487,7 @@ void CSystem::SetMultiMonitorInfo()
|
|||||||
}
|
}
|
||||||
LSLog(LOG_DEBUG, APPNAME, method.c_str());
|
LSLog(LOG_DEBUG, APPNAME, method.c_str());
|
||||||
|
|
||||||
DebugLog(L"* MONITORS: Count=%i, Primary=@%i", monitors.size(), c_Monitors.primary);
|
DebugLog(L"* MONITORS: Count=%i, Primary=@%i", (int)monitors.size(), c_Monitors.primary);
|
||||||
LSLog(LOG_DEBUG, APPNAME, L"@0: Virtual screen");
|
LSLog(LOG_DEBUG, APPNAME, L"@0: Virtual screen");
|
||||||
DebugLog(L" L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)",
|
DebugLog(L" L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)",
|
||||||
c_Monitors.vsL, c_Monitors.vsT, c_Monitors.vsL + c_Monitors.vsW, c_Monitors.vsT + c_Monitors.vsH,
|
c_Monitors.vsL, c_Monitors.vsT, c_Monitors.vsL + c_Monitors.vsW, c_Monitors.vsT + c_Monitors.vsH,
|
||||||
@ -497,14 +497,14 @@ void CSystem::SetMultiMonitorInfo()
|
|||||||
{
|
{
|
||||||
if (monitors[i].active)
|
if (monitors[i].active)
|
||||||
{
|
{
|
||||||
DebugLog(L"@%i: %s (active), MonitorName: %s", i + 1, monitors[i].deviceName, monitors[i].monitorName);
|
DebugLog(L"@%i: %s (active), MonitorName: %s", (int)i + 1, monitors[i].deviceName, monitors[i].monitorName);
|
||||||
DebugLog(L" L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)",
|
DebugLog(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
|
||||||
{
|
{
|
||||||
DebugLog(L"@%i: %s (inactive), MonitorName: %s", i + 1, monitors[i].deviceName, monitors[i].monitorName);
|
DebugLog(L"@%i: %s (inactive), MonitorName: %s", (int)i + 1, monitors[i].deviceName, monitors[i].monitorName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LSLog(LOG_DEBUG, APPNAME, L"------------------------------");
|
LSLog(LOG_DEBUG, APPNAME, L"------------------------------");
|
||||||
@ -539,7 +539,7 @@ void CSystem::UpdateWorkareaInfo()
|
|||||||
if (CRainmeter::GetDebug())
|
if (CRainmeter::GetDebug())
|
||||||
{
|
{
|
||||||
DebugLog(L"WorkArea@%i : L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)",
|
DebugLog(L"WorkArea@%i : L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)",
|
||||||
i + 1,
|
(int)i + 1,
|
||||||
info.rcWork.left, info.rcWork.top, info.rcWork.right, info.rcWork.bottom,
|
info.rcWork.left, info.rcWork.top, info.rcWork.right, info.rcWork.bottom,
|
||||||
info.rcWork.right - info.rcWork.left, info.rcWork.bottom - info.rcWork.top);
|
info.rcWork.right - info.rcWork.left, info.rcWork.bottom - info.rcWork.top);
|
||||||
}
|
}
|
||||||
@ -684,7 +684,7 @@ BOOL CALLBACK MyEnumWindowsProc(HWND hwnd, LPARAM lParam)
|
|||||||
ZPOSITION zPos = Window->GetWindowZPosition();
|
ZPOSITION zPos = Window->GetWindowZPosition();
|
||||||
if (zPos == ZPOSITION_ONDESKTOP || zPos == ZPOSITION_ONBOTTOM)
|
if (zPos == ZPOSITION_ONDESKTOP || zPos == ZPOSITION_ONBOTTOM)
|
||||||
{
|
{
|
||||||
if (logging) DebugLog(L"+ [%c] 0x%08X : %s (Name: \"%s\", zPos=%i)", IsWindowVisible(hwnd) ? L'V' : L'H', hwnd, className, Window->GetSkinName().c_str(), (int)zPos);
|
if (logging) DebugLog(L"+ [%c] 0x%p : %s (Name: \"%s\", zPos=%i)", IsWindowVisible(hwnd) ? L'V' : L'H', hwnd, className, Window->GetSkinName().c_str(), (int)zPos);
|
||||||
|
|
||||||
if (lParam)
|
if (lParam)
|
||||||
{
|
{
|
||||||
@ -693,12 +693,12 @@ BOOL CALLBACK MyEnumWindowsProc(HWND hwnd, LPARAM lParam)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (logging) DebugLog(L"- [%c] 0x%08X : %s (Name: \"%s\", zPos=%i)", IsWindowVisible(hwnd) ? L'V' : L'H', hwnd, className, Window->GetSkinName().c_str(), (int)zPos);
|
if (logging) DebugLog(L"- [%c] 0x%p : %s (Name: \"%s\", zPos=%i)", IsWindowVisible(hwnd) ? L'V' : L'H', hwnd, className, Window->GetSkinName().c_str(), (int)zPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (logging) DebugLog(L" [%c] 0x%08X : %s", IsWindowVisible(hwnd) ? L'V' : L'H', hwnd, className);
|
if (logging) DebugLog(L" [%c] 0x%p : %s", IsWindowVisible(hwnd) ? L'V' : L'H', hwnd, className);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -789,7 +789,7 @@ void CSystem::PrepareHelperWindow(HWND WorkerW)
|
|||||||
{
|
{
|
||||||
if (logging)
|
if (logging)
|
||||||
{
|
{
|
||||||
DebugLog(L"System: HelperWindow: hwnd=0x%08X (WorkerW=0x%08X), hwndInsertAfter=0x%08X (\"%s\" %s) - %s",
|
DebugLog(L"System: HelperWindow: hwnd=0x%p (WorkerW=0x%p), hwndInsertAfter=0x%p (\"%s\" %s) - %s",
|
||||||
c_HelperWindow, WorkerW, hwnd, windowText, className, (GetWindowLong(c_HelperWindow, GWL_EXSTYLE) & WS_EX_TOPMOST) ? L"TOPMOST" : L"NORMAL");
|
c_HelperWindow, WorkerW, hwnd, windowText, className, (GetWindowLong(c_HelperWindow, GWL_EXSTYLE) & WS_EX_TOPMOST) ? L"TOPMOST" : L"NORMAL");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -797,7 +797,7 @@ void CSystem::PrepareHelperWindow(HWND WorkerW)
|
|||||||
|
|
||||||
if (logging)
|
if (logging)
|
||||||
{
|
{
|
||||||
DebugLog(L"System: HelperWindow: hwnd=0x%08X (WorkerW=0x%08X), hwndInsertAfter=0x%08X (\"%s\" %s) - FAILED",
|
DebugLog(L"System: HelperWindow: hwnd=0x%p (WorkerW=0x%p), hwndInsertAfter=0x%p (\"%s\" %s) - FAILED",
|
||||||
c_HelperWindow, WorkerW, hwnd, windowText, className);
|
c_HelperWindow, WorkerW, hwnd, windowText, className);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -805,7 +805,7 @@ void CSystem::PrepareHelperWindow(HWND WorkerW)
|
|||||||
|
|
||||||
if (logging)
|
if (logging)
|
||||||
{
|
{
|
||||||
DebugLog(L"System: HelperWindow: hwnd=0x%08X (WorkerW=0x%08X), hwndInsertAfter=HWND_TOPMOST - %s",
|
DebugLog(L"System: HelperWindow: hwnd=0x%p (WorkerW=0x%p), hwndInsertAfter=HWND_TOPMOST - %s",
|
||||||
c_HelperWindow, WorkerW, (GetWindowLong(c_HelperWindow, GWL_EXSTYLE) & WS_EX_TOPMOST) ? L"TOPMOST" : L"NORMAL");
|
c_HelperWindow, WorkerW, (GetWindowLong(c_HelperWindow, GWL_EXSTYLE) & WS_EX_TOPMOST) ? L"TOPMOST" : L"NORMAL");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -816,7 +816,7 @@ void CSystem::PrepareHelperWindow(HWND WorkerW)
|
|||||||
|
|
||||||
if (logging)
|
if (logging)
|
||||||
{
|
{
|
||||||
DebugLog(L"System: HelperWindow: hwnd=0x%08X (WorkerW=0x%08X), hwndInsertAfter=HWND_BOTTOM - %s",
|
DebugLog(L"System: HelperWindow: hwnd=0x%p (WorkerW=0x%p), hwndInsertAfter=HWND_BOTTOM - %s",
|
||||||
c_HelperWindow, WorkerW, (GetWindowLong(c_HelperWindow, GWL_EXSTYLE) & WS_EX_TOPMOST) ? L"TOPMOST" : L"NORMAL");
|
c_HelperWindow, WorkerW, (GetWindowLong(c_HelperWindow, GWL_EXSTYLE) & WS_EX_TOPMOST) ? L"TOPMOST" : L"NORMAL");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ BOOL CTrayWindow::AddTrayIcon()
|
|||||||
tnid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
|
tnid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
|
||||||
tnid.uCallbackMessage = WM_NOTIFYICON;
|
tnid.uCallbackMessage = WM_NOTIFYICON;
|
||||||
tnid.hIcon = m_TrayIcon;
|
tnid.hIcon = m_TrayIcon;
|
||||||
lstrcpyn(tnid.szTip, L"Rainmeter", sizeof(tnid.szTip));
|
wcsncpy_s(tnid.szTip, L"Rainmeter", _TRUNCATE);
|
||||||
|
|
||||||
res = Shell_NotifyIcon(NIM_ADD, &tnid);
|
res = Shell_NotifyIcon(NIM_ADD, &tnid);
|
||||||
}
|
}
|
||||||
@ -338,7 +338,7 @@ void CTrayWindow::ReadConfig(CConfigParser& parser)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
WCHAR buffer[MAX_PATH];
|
WCHAR buffer[MAX_PATH];
|
||||||
wsprintf(buffer, imageName.c_str(), count++);
|
_snwprintf_s(buffer, _TRUNCATE, imageName.c_str(), count++);
|
||||||
|
|
||||||
hIcon = (HICON)LoadImage(NULL, buffer, IMAGE_ICON, TRAYICON_SIZE, TRAYICON_SIZE, LR_LOADFROMFILE);
|
hIcon = (HICON)LoadImage(NULL, buffer, IMAGE_ICON, TRAYICON_SIZE, TRAYICON_SIZE, LR_LOADFROMFILE);
|
||||||
if (hIcon) m_TrayIcons.push_back(hIcon);
|
if (hIcon) m_TrayIcons.push_back(hIcon);
|
||||||
@ -492,9 +492,9 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
// Check which config was selected
|
// Check which config was selected
|
||||||
const std::vector<CRainmeter::CONFIG>& configs = Rainmeter->GetAllConfigs();
|
const std::vector<CRainmeter::CONFIG>& configs = Rainmeter->GetAllConfigs();
|
||||||
|
|
||||||
for (size_t i = 0; i < configs.size(); ++i)
|
for (int i = 0; i < (int)configs.size(); ++i)
|
||||||
{
|
{
|
||||||
for (size_t j = 0; j < configs[i].commands.size(); ++j)
|
for (int j = 0; j < (int)configs[i].commands.size(); ++j)
|
||||||
{
|
{
|
||||||
if (configs[i].commands[j] == wParam)
|
if (configs[i].commands[j] == wParam)
|
||||||
{
|
{
|
||||||
@ -600,7 +600,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
const std::wstring& path = Rainmeter->GetSkinPath();
|
const std::wstring& path = Rainmeter->GetSkinPath();
|
||||||
|
|
||||||
cds.dwData = RAINMETER_QUERY_ID_SKINS_PATH;
|
cds.dwData = RAINMETER_QUERY_ID_SKINS_PATH;
|
||||||
cds.cbData = (path.size() + 1) * sizeof(wchar_t);
|
cds.cbData = (DWORD)((path.size() + 1) * sizeof(wchar_t));
|
||||||
cds.lpData = (LPVOID) path.c_str();
|
cds.lpData = (LPVOID) path.c_str();
|
||||||
|
|
||||||
SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
|
SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
|
||||||
@ -612,7 +612,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
std::wstring path = Rainmeter->GetSettingsPath();
|
std::wstring path = Rainmeter->GetSettingsPath();
|
||||||
|
|
||||||
cds.dwData = RAINMETER_QUERY_ID_SETTINGS_PATH;
|
cds.dwData = RAINMETER_QUERY_ID_SETTINGS_PATH;
|
||||||
cds.cbData = (path.size() + 1) * sizeof(wchar_t);
|
cds.cbData = (DWORD)((path.size() + 1) * sizeof(wchar_t));
|
||||||
cds.lpData = (LPVOID) path.c_str();
|
cds.lpData = (LPVOID) path.c_str();
|
||||||
|
|
||||||
SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
|
SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
|
||||||
@ -624,7 +624,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
const std::wstring& path = Rainmeter->GetPluginPath();
|
const std::wstring& path = Rainmeter->GetPluginPath();
|
||||||
|
|
||||||
cds.dwData = RAINMETER_QUERY_ID_PLUGINS_PATH;
|
cds.dwData = RAINMETER_QUERY_ID_PLUGINS_PATH;
|
||||||
cds.cbData = (path.size() + 1) * sizeof(wchar_t);
|
cds.cbData = (DWORD)((path.size() + 1) * sizeof(wchar_t));
|
||||||
cds.lpData = (LPVOID) path.c_str();
|
cds.lpData = (LPVOID) path.c_str();
|
||||||
|
|
||||||
SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
|
SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
|
||||||
@ -636,7 +636,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
const std::wstring& path = Rainmeter->GetPath();
|
const std::wstring& path = Rainmeter->GetPath();
|
||||||
|
|
||||||
cds.dwData = RAINMETER_QUERY_ID_PROGRAM_PATH;
|
cds.dwData = RAINMETER_QUERY_ID_PROGRAM_PATH;
|
||||||
cds.cbData = (path.size() + 1) * sizeof(wchar_t);
|
cds.cbData = (DWORD)((path.size() + 1) * sizeof(wchar_t));
|
||||||
cds.lpData = (LPVOID) path.c_str();
|
cds.lpData = (LPVOID) path.c_str();
|
||||||
|
|
||||||
SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
|
SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
|
||||||
@ -648,7 +648,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
const std::wstring& path = Rainmeter->GetLogFile();
|
const std::wstring& path = Rainmeter->GetLogFile();
|
||||||
|
|
||||||
cds.dwData = RAINMETER_QUERY_ID_LOG_PATH;
|
cds.dwData = RAINMETER_QUERY_ID_LOG_PATH;
|
||||||
cds.cbData = (path.size() + 1) * sizeof(wchar_t);
|
cds.cbData = (DWORD)((path.size() + 1) * sizeof(wchar_t));
|
||||||
cds.lpData = (LPVOID) path.c_str();
|
cds.lpData = (LPVOID) path.c_str();
|
||||||
|
|
||||||
SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
|
SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
|
||||||
@ -660,7 +660,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
const std::wstring& editor = Rainmeter->GetConfigEditor();
|
const std::wstring& editor = Rainmeter->GetConfigEditor();
|
||||||
|
|
||||||
cds.dwData = RAINMETER_QUERY_ID_CONFIG_EDITOR;
|
cds.dwData = RAINMETER_QUERY_ID_CONFIG_EDITOR;
|
||||||
cds.cbData = (editor.size() + 1) * sizeof(wchar_t);
|
cds.cbData = (DWORD)((editor.size() + 1) * sizeof(wchar_t));
|
||||||
cds.lpData = (LPVOID) editor.c_str();
|
cds.lpData = (LPVOID) editor.c_str();
|
||||||
|
|
||||||
SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
|
SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
|
||||||
@ -672,7 +672,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
std::wstring commandline = Rainmeter->GetCommandLine();
|
std::wstring commandline = Rainmeter->GetCommandLine();
|
||||||
|
|
||||||
cds.dwData = RAINMETER_QUERY_ID_COMMAND_LINE;
|
cds.dwData = RAINMETER_QUERY_ID_COMMAND_LINE;
|
||||||
cds.cbData = (commandline.size() + 1) * sizeof(wchar_t);
|
cds.cbData = (DWORD)((commandline.size() + 1) * sizeof(wchar_t));
|
||||||
cds.lpData = (LPVOID) commandline.c_str();
|
cds.lpData = (LPVOID) commandline.c_str();
|
||||||
|
|
||||||
SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
|
SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
|
||||||
@ -700,7 +700,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
const std::wstring& date = Rainmeter->GetStatsDate();
|
const std::wstring& date = Rainmeter->GetStatsDate();
|
||||||
|
|
||||||
cds.dwData = RAINMETER_QUERY_ID_STATS_DATE;
|
cds.dwData = RAINMETER_QUERY_ID_STATS_DATE;
|
||||||
cds.cbData = (date.size() + 1) * sizeof(wchar_t);
|
cds.cbData = (DWORD)((date.size() + 1) * sizeof(wchar_t));
|
||||||
cds.lpData = (LPVOID) date.c_str();
|
cds.lpData = (LPVOID) date.c_str();
|
||||||
|
|
||||||
SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
|
SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
|
||||||
@ -712,7 +712,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
const std::wstring& tray = Rainmeter->GetTrayExecuteL();
|
const std::wstring& tray = Rainmeter->GetTrayExecuteL();
|
||||||
|
|
||||||
cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_L;
|
cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_L;
|
||||||
cds.cbData = (tray.size() + 1) * sizeof(wchar_t);
|
cds.cbData = (DWORD)((tray.size() + 1) * sizeof(wchar_t));
|
||||||
cds.lpData = (LPVOID) tray.c_str();
|
cds.lpData = (LPVOID) tray.c_str();
|
||||||
|
|
||||||
SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
|
SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
|
||||||
@ -724,7 +724,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
const std::wstring& tray = Rainmeter->GetTrayExecuteR();
|
const std::wstring& tray = Rainmeter->GetTrayExecuteR();
|
||||||
|
|
||||||
cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_R;
|
cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_R;
|
||||||
cds.cbData = (tray.size() + 1) * sizeof(wchar_t);
|
cds.cbData = (DWORD)((tray.size() + 1) * sizeof(wchar_t));
|
||||||
cds.lpData = (LPVOID) tray.c_str();
|
cds.lpData = (LPVOID) tray.c_str();
|
||||||
|
|
||||||
SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
|
SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
|
||||||
@ -736,7 +736,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
const std::wstring& tray = Rainmeter->GetTrayExecuteM();
|
const std::wstring& tray = Rainmeter->GetTrayExecuteM();
|
||||||
|
|
||||||
cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_M;
|
cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_M;
|
||||||
cds.cbData = (tray.size() + 1) * sizeof(wchar_t);
|
cds.cbData = (DWORD)((tray.size() + 1) * sizeof(wchar_t));
|
||||||
cds.lpData = (LPVOID) tray.c_str();
|
cds.lpData = (LPVOID) tray.c_str();
|
||||||
|
|
||||||
SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
|
SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
|
||||||
@ -748,7 +748,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
const std::wstring& tray = Rainmeter->GetTrayExecuteDL();
|
const std::wstring& tray = Rainmeter->GetTrayExecuteDL();
|
||||||
|
|
||||||
cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_DL;
|
cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_DL;
|
||||||
cds.cbData = (tray.size() + 1) * sizeof(wchar_t);
|
cds.cbData = (DWORD)((tray.size() + 1) * sizeof(wchar_t));
|
||||||
cds.lpData = (LPVOID) tray.c_str();
|
cds.lpData = (LPVOID) tray.c_str();
|
||||||
|
|
||||||
SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
|
SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
|
||||||
@ -760,7 +760,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
const std::wstring& tray = Rainmeter->GetTrayExecuteDR();
|
const std::wstring& tray = Rainmeter->GetTrayExecuteDR();
|
||||||
|
|
||||||
cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_DR;
|
cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_DR;
|
||||||
cds.cbData = (tray.size() + 1) * sizeof(wchar_t);
|
cds.cbData = (DWORD)((tray.size() + 1) * sizeof(wchar_t));
|
||||||
cds.lpData = (LPVOID) tray.c_str();
|
cds.lpData = (LPVOID) tray.c_str();
|
||||||
|
|
||||||
SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
|
SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
|
||||||
@ -772,7 +772,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
const std::wstring& tray = Rainmeter->GetTrayExecuteDM();
|
const std::wstring& tray = Rainmeter->GetTrayExecuteDM();
|
||||||
|
|
||||||
cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_DM;
|
cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_DM;
|
||||||
cds.cbData = (tray.size() + 1) * sizeof(wchar_t);
|
cds.cbData = (DWORD)((tray.size() + 1) * sizeof(wchar_t));
|
||||||
cds.lpData = (LPVOID) tray.c_str();
|
cds.lpData = (LPVOID) tray.c_str();
|
||||||
|
|
||||||
SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
|
SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
|
||||||
|
@ -63,10 +63,10 @@ void LuaManager::LuaLog(const char* format, ... )
|
|||||||
_CrtSetReportMode(_CRT_ASSERT, 0);
|
_CrtSetReportMode(_CRT_ASSERT, 0);
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
_vsnprintf_s( buffer, 4096, _TRUNCATE, format, args );
|
_vsnprintf_s( buffer, _TRUNCATE, format, args );
|
||||||
if (errno != 0)
|
if (errno != 0)
|
||||||
{
|
{
|
||||||
_snprintf_s(buffer, 4096, _TRUNCATE, "LuaLog internal error: %s", format);
|
_snprintf_s(buffer, _TRUNCATE, "LuaLog internal error: %s", format);
|
||||||
}
|
}
|
||||||
|
|
||||||
_set_invalid_parameter_handler(oldHandler);
|
_set_invalid_parameter_handler(oldHandler);
|
||||||
|
Loading…
Reference in New Issue
Block a user