This commit is contained in:
spx 2011-06-02 01:54:05 +00:00
parent 72f5d55090
commit 0841328ea0
2 changed files with 31 additions and 28 deletions

View File

@ -4986,7 +4986,7 @@ LRESULT CMeterWindow::OnCopyData(UINT uMsg, WPARAM wParam, LPARAM lParam)
if (!found)
{
Log(LOG_WARNING, L"Unable to send the !bang to a deactivated config.");
return 0; // This meterwindow has been deactivated
return TRUE; // This meterwindow has been deactivated
}
std::wstring str = (const WCHAR*)pCopyDataStruct->lpData;

View File

@ -214,11 +214,14 @@ LPCTSTR PluginBridge(LPCTSTR _sCommand, LPCTSTR _sData)
{
static std::wstring result;
if (_sCommand == NULL) _sCommand = L"";
if (_sCommand == NULL || *_sCommand == L'\0')
{
return L"noop";
}
if (_sData == NULL) _sData = L"";
std::wstring sCommand = _sCommand;
std::wstring sData = _sData;
std::transform(sCommand.begin(), sCommand.end(), sCommand.begin(), ::towlower);
// Command GetConfig
@ -230,7 +233,7 @@ LPCTSTR PluginBridge(LPCTSTR _sCommand, LPCTSTR _sData)
{
// returns the config name, lookup by INI file
CMeterWindow *meterWindow = Rainmeter->GetMeterWindowByINI(sData);
CMeterWindow *meterWindow = Rainmeter->GetMeterWindowByINI(_sData);
if (meterWindow)
{
result = L"\"";
@ -242,6 +245,30 @@ LPCTSTR PluginBridge(LPCTSTR _sCommand, LPCTSTR _sData)
return L"";
}
// 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)
{
const std::wstring& config = subStrings[0];
CMeterWindow *meterWindow = Rainmeter->GetMeterWindow(config);
if (meterWindow)
{
WCHAR buf1[64];
_snwprintf_s(buf1, _TRUNCATE, L"%lu", PtrToUlong(meterWindow->GetWindow()));
result = buf1;
return result.c_str();
}
}
return L"error";
}
// Command SkinAuthor
// Data the config name
// Execution none
@ -334,30 +361,6 @@ LPCTSTR PluginBridge(LPCTSTR _sCommand, LPCTSTR _sData)
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)
{
const 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";
}