From 9d057cf06cdedc6c6323765b34ec2d5d26caa1e9 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 8 Jun 2023 13:06:50 +0300 Subject: Toaster: cache Miranda's app icon for the future use --- plugins/Toaster/src/main.cpp | 4 ++-- plugins/Toaster/src/services.cpp | 3 +++ plugins/Toaster/src/stdafx.h | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/Toaster/src/main.cpp b/plugins/Toaster/src/main.cpp index 4fd340fb81..06c61e2dc0 100644 --- a/plugins/Toaster/src/main.cpp +++ b/plugins/Toaster/src/main.cpp @@ -46,13 +46,13 @@ int CMPlugin::Load() HookEvent(ME_OPT_INITIALISE, OnOptionsInitialized); HookEvent(ME_SYSTEM_SHUTDOWN, &OnShutdown); - InitServices(); - if (GetEnvironmentVariableW(L"TEMP", wszTempDir, MAX_PATH) != 0) { wcscat_s(wszTempDir, L"\\Miranda.Toaster"); CreateDirectoryTreeW(wszTempDir); } else MessageBox(nullptr, TranslateT("Failed to create temporary directory"), _T(MODULENAME), MB_OK | MB_ICONERROR); + InitServices(); + return 0; } diff --git a/plugins/Toaster/src/services.cpp b/plugins/Toaster/src/services.cpp index b70dfe253d..634949eb76 100644 --- a/plugins/Toaster/src/services.cpp +++ b/plugins/Toaster/src/services.cpp @@ -2,6 +2,7 @@ std::map mp_Classes; wchar_t wszTempDir[MAX_PATH]; +ptrW g_wszAppIcon; void __stdcall ShowToastNotification(void *p) { @@ -203,4 +204,6 @@ void InitServices() CreateServiceFunction(MS_POPUP_GETCONTACT, GetPopupContact); CreateServiceFunction(MS_POPUP_DESTROYPOPUP, HideToast); + + g_wszAppIcon = ToasterImage(IcoLib_GetIconByHandle(Skin_GetIconHandle(SKINICON_OTHER_MIRANDA), true)).Save(); } diff --git a/plugins/Toaster/src/stdafx.h b/plugins/Toaster/src/stdafx.h index e594613485..a0ccd5e4a8 100644 --- a/plugins/Toaster/src/stdafx.h +++ b/plugins/Toaster/src/stdafx.h @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include -- cgit v1.2.3