Fixed an issue that Rainmeter crashes if bang is executed via exe during initializing the skins.

This commit is contained in:
spx
2011-02-16 14:46:17 +00:00
parent cb3a7d3a75
commit 96f8407c74
3 changed files with 25 additions and 8 deletions

View File

@ -119,7 +119,7 @@ BOOL CTrayWindow::AddTrayIcon()
tnid.hWnd = m_Window;
tnid.uID = IDI_TRAY;
tnid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
tnid.uCallbackMessage = WM_NOTIFYICON;
tnid.uCallbackMessage = WM_TRAY_NOTIFYICON;
tnid.hIcon = m_TrayIcon;
wcsncpy_s(tnid.szTip, L"Rainmeter", _TRUNCATE);
@ -410,7 +410,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
}
else if(wParam == ID_CONTEXT_REFRESH)
{
PostMessage(tray->GetWindow(), WM_DELAYED_REFRESH_ALL, (WPARAM)NULL, (LPARAM)NULL);
PostMessage(tray->GetWindow(), WM_TRAY_DELAYED_REFRESH_ALL, (WPARAM)NULL, (LPARAM)NULL);
}
else if(wParam == ID_CONTEXT_SHOWLOGFILE)
{
@ -538,7 +538,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
}
return 0; // Don't send WM_COMMANDS any further
case WM_NOTIFYICON:
case WM_TRAY_NOTIFYICON:
{
UINT uMouseMsg = (UINT)lParam;
@ -810,7 +810,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
}
break;
case WM_DELAYED_REFRESH_ALL:
case WM_TRAY_DELAYED_REFRESH_ALL:
if (Rainmeter)
{
// Refresh all
@ -818,6 +818,16 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
}
return 0;
case WM_TRAY_DELAYED_EXECUTE:
if (Rainmeter && lParam)
{
// Execute bang
WCHAR* bang = (WCHAR*)lParam;
Rainmeter->ExecuteCommand(bang, NULL);
free(bang); // _wcsdup()
}
return 0;
case WM_DESTROY:
if (Rainmeter->GetDummyLitestep()) PostQuitMessage(0);
break;