mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Error messages now display meter/measure in question.
This commit is contained in:
@ -53,58 +53,58 @@ CMeasureRegistry::~CMeasureRegistry()
|
||||
*/
|
||||
bool CMeasureRegistry::Update()
|
||||
{
|
||||
if (!CMeasure::PreUpdate()) return false;
|
||||
if (!CMeasure::PreUpdate()) return false;
|
||||
|
||||
if(m_RegKey != NULL)
|
||||
{
|
||||
DWORD size = 4096;
|
||||
WCHAR data[4096];
|
||||
DWORD type = 0;
|
||||
if(m_RegKey != NULL)
|
||||
{
|
||||
DWORD size = 4096;
|
||||
WCHAR data[4096];
|
||||
DWORD type = 0;
|
||||
|
||||
if(RegQueryValueEx(m_RegKey,
|
||||
m_RegValueName.c_str(),
|
||||
NULL,
|
||||
(LPDWORD)&type,
|
||||
(LPBYTE)&data,
|
||||
(LPDWORD)&size) == ERROR_SUCCESS)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case REG_DWORD:
|
||||
m_Value = *((LPDWORD)&data);
|
||||
m_StringValue.erase();
|
||||
break;
|
||||
if(RegQueryValueEx(m_RegKey,
|
||||
m_RegValueName.c_str(),
|
||||
NULL,
|
||||
(LPDWORD)&type,
|
||||
(LPBYTE)&data,
|
||||
(LPDWORD)&size) == ERROR_SUCCESS)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case REG_DWORD:
|
||||
m_Value = *((LPDWORD)&data);
|
||||
m_StringValue.erase();
|
||||
break;
|
||||
|
||||
case REG_SZ:
|
||||
case REG_EXPAND_SZ:
|
||||
case REG_MULTI_SZ:
|
||||
m_Value = 0.0;
|
||||
m_StringValue = data;
|
||||
break;
|
||||
case REG_SZ:
|
||||
case REG_EXPAND_SZ:
|
||||
case REG_MULTI_SZ:
|
||||
m_Value = 0.0;
|
||||
m_StringValue = data;
|
||||
break;
|
||||
|
||||
case REG_QWORD:
|
||||
m_Value = (double)((LARGE_INTEGER*)&data)->QuadPart;
|
||||
m_StringValue.erase();
|
||||
break;
|
||||
case REG_QWORD:
|
||||
m_Value = (double)((LARGE_INTEGER*)&data)->QuadPart;
|
||||
m_StringValue.erase();
|
||||
break;
|
||||
|
||||
default: // Other types are not supported
|
||||
m_Value = 0.0;
|
||||
m_StringValue.erase();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Value = 0.0;
|
||||
m_StringValue.erase();
|
||||
RegOpenKeyEx(m_HKey, m_RegKeyName.c_str(), 0, KEY_READ, &m_RegKey);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RegOpenKeyEx(m_HKey, m_RegKeyName.c_str(), 0, KEY_READ, &m_RegKey);
|
||||
}
|
||||
default: // Other types are not supported
|
||||
m_Value = 0.0;
|
||||
m_StringValue.erase();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Value = 0.0;
|
||||
m_StringValue.erase();
|
||||
RegOpenKeyEx(m_HKey, m_RegKeyName.c_str(), 0, KEY_READ, &m_RegKey);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RegOpenKeyEx(m_HKey, m_RegKeyName.c_str(), 0, KEY_READ, &m_RegKey);
|
||||
}
|
||||
|
||||
return PostUpdate();
|
||||
return PostUpdate();
|
||||
}
|
||||
|
||||
/*
|
||||
@ -150,7 +150,7 @@ void CMeasureRegistry::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
||||
}
|
||||
else
|
||||
{
|
||||
throw CError(std::wstring(L"No such HKEY: ") + keyname, __LINE__, __FILE__);
|
||||
throw CError(std::wstring(L"HKEY=") + keyname + L" is not valid in measure [" + section + L"].", __LINE__, __FILE__);
|
||||
}
|
||||
|
||||
m_RegKeyName = parser.ReadString(section, L"RegKey", L"");
|
||||
@ -164,7 +164,7 @@ void CMeasureRegistry::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
||||
|
||||
// Try to open the key
|
||||
if(m_RegKey) RegCloseKey(m_RegKey);
|
||||
RegOpenKeyEx(m_HKey, m_RegKeyName.c_str(), 0, KEY_READ, &m_RegKey);
|
||||
RegOpenKeyEx(m_HKey, m_RegKeyName.c_str(), 0, KEY_READ, &m_RegKey);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -176,7 +176,7 @@ void CMeasureRegistry::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
||||
*/
|
||||
const WCHAR* CMeasureRegistry::GetStringValue(bool autoScale, double scale, int decimals, bool percentual)
|
||||
{
|
||||
if (m_StringValue.empty())
|
||||
if (m_StringValue.empty())
|
||||
{
|
||||
return CMeasure::GetStringValue(autoScale, scale, decimals, percentual);
|
||||
}
|
||||
|
Reference in New Issue
Block a user