diff --git a/Library/MeterWindow.cpp b/Library/MeterWindow.cpp index c82cff5b..87660218 100644 --- a/Library/MeterWindow.cpp +++ b/Library/MeterWindow.cpp @@ -3978,9 +3978,8 @@ LRESULT CMeterWindow::OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lPara } // Snap to other windows - const std::map& windows = m_Rainmeter->GetAllMeterWindows(); - std::map::const_iterator iter = windows.begin(); - for ( ; iter != windows.end(); ++iter) + std::map::const_iterator iter = m_Rainmeter->GetAllMeterWindows().begin(); + for ( ; iter != m_Rainmeter->GetAllMeterWindows().end(); ++iter) { if ((*iter).second != this) { @@ -4908,10 +4907,8 @@ LRESULT CMeterWindow::OnCopyData(UINT uMsg, WPARAM wParam, LPARAM lParam) { // Check that we're still alive bool found = false; - const std::map& meters = m_Rainmeter->GetAllMeterWindows(); - std::map::const_iterator iter = meters.begin(); - - for ( ; iter != meters.end(); ++iter) + std::map::const_iterator iter = m_Rainmeter->GetAllMeterWindows().begin(); + for ( ; iter != m_Rainmeter->GetAllMeterWindows().end(); ++iter) { if ((*iter).second == this) { diff --git a/Library/System.cpp b/Library/System.cpp index 928811b4..70f60fc3 100644 --- a/Library/System.cpp +++ b/Library/System.cpp @@ -795,8 +795,8 @@ void CSystem::ChangeZPosInOrder() auto resetZPos = [&](ZPOSITION zpos) { // Reset ZPos in Z-order (Bottom) - std::vector::const_iterator iter = windowsInZOrder.begin(), iterEnd = windowsInZOrder.end(); - for ( ; iter != iterEnd; ++iter) + std::vector::const_iterator iter = windowsInZOrder.begin(); + for ( ; iter != windowsInZOrder.end(); ++iter) { if ((*iter)->GetWindowZPosition() == zpos) { @@ -1036,9 +1036,8 @@ LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP } // Deliver WM_DISPLAYCHANGE / WM_SETTINGCHANGE message to all meter windows - const std::map& windows = Rainmeter->GetAllMeterWindows(); - std::map::const_iterator iter = windows.begin(); - for ( ; iter != windows.end(); ++iter) + std::map::const_iterator iter = Rainmeter->GetAllMeterWindows().begin(); + for ( ; iter != Rainmeter->GetAllMeterWindows().end(); ++iter) { PostMessage((*iter).second->GetWindow(), WM_DELAYED_MOVE, (WPARAM)uMsg, (LPARAM)0); } diff --git a/Library/TrayWindow.cpp b/Library/TrayWindow.cpp index e534ea24..5c8f8c88 100644 --- a/Library/TrayWindow.cpp +++ b/Library/TrayWindow.cpp @@ -679,16 +679,8 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA if (cds->dwData == RAINMETER_QUERY_ID_SKIN_WINDOWHANDLE) { LPCWSTR configName = (LPCWSTR)cds->lpData; - const std::map& windows = Rainmeter->GetAllMeterWindows(); - std::map::const_iterator iter = windows.begin(); - for ( ; iter != windows.end(); ++iter) - { - if (wcscmp((*iter).first.c_str(), configName) == 0) - { - return (LRESULT)(*iter).second->GetWindow(); - } - } - return NULL; + CMeterWindow* mw = Rainmeter->GetMeterWindow(configName); + return (mw) ? (LRESULT)mw->GetWindow() : NULL; } } return 1;