!WriteKeyValue: Fixed that formulas didn't work.

This commit is contained in:
Birunthan Mohanathas 2012-02-19 13:16:21 +00:00
parent 57025a5434
commit eca9250655

View File

@ -608,23 +608,19 @@ void CRainmeter::Bang_WriteKeyValue(const WCHAR* arg, CMeterWindow* meterWindow)
bool formula = false; bool formula = false;
BOOL write = 0; BOOL write = 0;
if (subStrings.size() > 4) if (meterWindow)
{ {
CMeterWindow* mw = GetMeterWindow(subStrings[4]); double value;
if (mw) formula = meterWindow->GetParser().ParseFormula(strValue, &value);
// Formula read fine
if (formula)
{ {
double value; WCHAR buffer[256];
formula = mw->GetParser().ParseFormula(strValue, &value); int len = _snwprintf_s(buffer, _TRUNCATE, L"%.5f", value);
CMeasure::RemoveTrailingZero(buffer, len);
// Formula read fine write = WritePrivateProfileString(section, key, buffer, iniWrite);
if (formula)
{
WCHAR buffer[256];
int len = _snwprintf_s(buffer, _TRUNCATE, L"%.5f", value);
CMeasure::RemoveTrailingZero(buffer, len);
write = WritePrivateProfileString(section, key, buffer, iniWrite);
}
} }
} }