Fixing errors caused by r549.

This commit is contained in:
Birunthan Mohanathas 2010-09-23 08:49:43 +00:00
parent c1fda93526
commit 9da555a187
5 changed files with 344 additions and 334 deletions

View File

@ -53,58 +53,58 @@ CMeasureRegistry::~CMeasureRegistry()
*/ */
bool CMeasureRegistry::Update() bool CMeasureRegistry::Update()
{ {
if (!CMeasure::PreUpdate()) return false; if (!CMeasure::PreUpdate()) return false;
if(m_RegKey != NULL) 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)
{ {
DWORD size = 4096; switch(type)
WCHAR data[4096]; {
DWORD type = 0; case REG_DWORD:
m_Value = *((LPDWORD)&data);
m_StringValue.erase();
break;
if(RegQueryValueEx(m_RegKey, case REG_SZ:
m_RegValueName.c_str(), case REG_EXPAND_SZ:
NULL, case REG_MULTI_SZ:
(LPDWORD)&type, m_Value = 0.0;
(LPBYTE)&data, m_StringValue = data;
(LPDWORD)&size) == ERROR_SUCCESS) break;
{
switch(type)
{
case REG_DWORD:
m_Value = *((LPDWORD)&data);
m_StringValue.erase();
break;
case REG_SZ: case REG_QWORD:
case REG_EXPAND_SZ: m_Value = (double)((LARGE_INTEGER*)&data)->QuadPart;
case REG_MULTI_SZ: m_StringValue.erase();
m_Value = 0.0; break;
m_StringValue = data;
break;
case REG_QWORD: default: // Other types are not supported
m_Value = (double)((LARGE_INTEGER*)&data)->QuadPart; m_Value = 0.0;
m_StringValue.erase(); 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 else
{ {
RegOpenKeyEx(m_HKey, m_RegKeyName.c_str(), 0, KEY_READ, &m_RegKey); 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();
} }
/* /*

View File

@ -102,7 +102,9 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
{ {
std::wstring error = L"RecycleType="; std::wstring error = L"RecycleType=";
error += type; error += type;
error += L" is not valid in measure [" + section + L"]."; error += L" is not valid in measure [";
error += section;
error += L"].";
MessageBox(NULL, error.c_str(), L"Rainmeter", MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); MessageBox(NULL, error.c_str(), L"Rainmeter", MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
} }
} }

View File

@ -115,7 +115,9 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
{ {
std::wstring error = L"GDICountType="; std::wstring error = L"GDICountType=";
error += type; error += type;
error += L" is not valid in measure [" + section + L"]."; error += L" is not valid in measure [";
error += section;
error += L"].";
MessageBox(NULL, error.c_str(), L"Rainmeter", MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); MessageBox(NULL, error.c_str(), L"Rainmeter", MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
} }
} }

View File

@ -113,7 +113,9 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
{ {
std::wstring error = L"SpeedFanScale="; std::wstring error = L"SpeedFanScale=";
error += scale; error += scale;
error += L" is not valid in measure [" + section + L"]." ; error += L" is not valid in measure [";
error += section;
error += L"].";
MessageBox(NULL, error.c_str(), L"Rainmeter", MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); MessageBox(NULL, error.c_str(), L"Rainmeter", MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
} }
} }
@ -130,7 +132,9 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
{ {
std::wstring error = L"SpeedFanType="; std::wstring error = L"SpeedFanType=";
error += type; error += type;
error += L" is not valid in measure [" + section + L"]." ; error += L" is not valid in measure [";
error += section;
error += L"].";
MessageBox(NULL, error.c_str(), L"Rainmeter", MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); MessageBox(NULL, error.c_str(), L"Rainmeter", MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
} }
} }

View File

@ -209,7 +209,9 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
{ {
std::wstring error = L"SysInfoType="; std::wstring error = L"SysInfoType=";
error += type; error += type;
error += L" is not valid in measure [" + section + L"]." ; error += L" is not valid in measure [";
error += section;
error += L"].";
MessageBox(NULL, error.c_str(), L"Rainmeter", MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); MessageBox(NULL, error.c_str(), L"Rainmeter", MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
} }
} }