From 067a48827e8bae1bc595f3268e18996314843396 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 17 May 2018 20:53:02 +0300 Subject: OpenFolder, PackUpdater, PasteIt, Ping, QuickMessages, QuickReplies, Sessions, TranslitSwitcher => CMPlugin --- plugins/PackUpdater/Src/Notifications.cpp | 6 +++--- plugins/PackUpdater/Src/Options.cpp | 2 +- plugins/PackUpdater/Src/PackUpdater.cpp | 19 ++++++++++--------- plugins/PackUpdater/Src/Utils.cpp | 4 ++-- plugins/PackUpdater/Src/stdafx.h | 9 +++++++-- 5 files changed, 23 insertions(+), 17 deletions(-) (limited to 'plugins/PackUpdater') diff --git a/plugins/PackUpdater/Src/Notifications.cpp b/plugins/PackUpdater/Src/Notifications.cpp index 3e15b6ed56..e2e3d9793c 100644 --- a/plugins/PackUpdater/Src/Notifications.cpp +++ b/plugins/PackUpdater/Src/Notifications.cpp @@ -177,10 +177,10 @@ INT_PTR CALLBACK DlgDownloadPop(HWND hDlg, UINT uMsg, WPARAM, LPARAM) static void __stdcall CreateDownloadDialog(void*) { if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups3", DEFAULT_POPUP_ENABLED)) - hDlgDld = CreateDialog(hInst, MAKEINTRESOURCE(IDD_POPUPDUMMI), nullptr, DlgDownloadPop); + hDlgDld = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_POPUPDUMMI), nullptr, DlgDownloadPop); else if (db_get_b(NULL, MODNAME, "Popups3M", DEFAULT_MESSAGE_ENABLED)) { mir_wstrncpy(tszDialogMsg, Text, _countof(tszDialogMsg)); - hDlgDld = CreateDialog(hInst, MAKEINTRESOURCE(IDD_DOWNLOAD), nullptr, DlgDownload); + hDlgDld = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DOWNLOAD), nullptr, DlgDownload); } } @@ -421,7 +421,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam Title = TranslateT("Pack Updater"); Text = tszBuff; if (ServiceExists(MS_POPUP_ADDPOPUPT) && ServiceExists(MS_POPUP_REGISTERACTIONS) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups0", DEFAULT_POPUP_ENABLED) && (db_get_dw(NULL, "Popup", "Actions", 0) & 1)) - rc = DialogBox(hInst, MAKEINTRESOURCE(IDD_POPUPDUMMI), nullptr, DlgMsgPop); + rc = DialogBox(g_plugin.getInst(), MAKEINTRESOURCE(IDD_POPUPDUMMI), nullptr, DlgMsgPop); else rc = MessageBox(nullptr, tszBuff, Title, MB_YESNO | MB_ICONQUESTION); if (rc == IDYES) { diff --git a/plugins/PackUpdater/Src/Options.cpp b/plugins/PackUpdater/Src/Options.cpp index a93d6de456..f7701cb158 100644 --- a/plugins/PackUpdater/Src/Options.cpp +++ b/plugins/PackUpdater/Src/Options.cpp @@ -382,7 +382,7 @@ int OptInit(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; odp.position = 100000000; - odp.hInstance = hInst; + odp.hInstance = g_plugin.getInst(); odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_UPDATENOTIFY); odp.szGroup.w = LPGENW("Services"); diff --git a/plugins/PackUpdater/Src/PackUpdater.cpp b/plugins/PackUpdater/Src/PackUpdater.cpp index 81da988409..4a47392e0a 100644 --- a/plugins/PackUpdater/Src/PackUpdater.cpp +++ b/plugins/PackUpdater/Src/PackUpdater.cpp @@ -19,13 +19,16 @@ Boston, MA 02111-1307, USA. #include "stdafx.h" -HINSTANCE hInst = nullptr; - HANDLE hPackUpdaterFolder = nullptr; wchar_t tszRoot[MAX_PATH] = { 0 }; + int hLangpack; +CMPlugin g_plugin; + +///////////////////////////////////////////////////////////////////////////////////////// -PLUGININFOEX pluginInfoEx = { +PLUGININFOEX pluginInfoEx = +{ sizeof(PLUGININFOEX), __PLUGIN_NAME, PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), @@ -38,17 +41,13 @@ PLUGININFOEX pluginInfoEx = { { 0x29517be5, 0x779a, 0x48e5, { 0x89, 0x50, 0xcb, 0x4d, 0xe1, 0xd4, 0x31, 0x72 } } }; -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) -{ - hInst = hinstDLL; - return TRUE; -} - extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) { return &pluginInfoEx; } +///////////////////////////////////////////////////////////////////////////////////////// + extern "C" __declspec(dllexport) int Load(void) { mir_getLP(&pluginInfoEx); @@ -97,6 +96,8 @@ extern "C" __declspec(dllexport) int Load(void) return 0; } +///////////////////////////////////////////////////////////////////////////////////////// + extern "C" __declspec(dllexport) int Unload(void) { if (hCheckThread) diff --git a/plugins/PackUpdater/Src/Utils.cpp b/plugins/PackUpdater/Src/Utils.cpp index 9554653ffd..36e04c722f 100644 --- a/plugins/PackUpdater/Src/Utils.cpp +++ b/plugins/PackUpdater/Src/Utils.cpp @@ -44,7 +44,7 @@ IconItem iconList[] = void IcoLibInit() { - Icon_Register(hInst, MODULEA, iconList, _countof(iconList)); + Icon_Register(g_plugin.getInst(), MODULEA, iconList, _countof(iconList)); } BOOL NetlibInit() @@ -330,7 +330,7 @@ static void CheckUpdates(void *) // Show dialog INT upd_ret = 0; if (UpdateFiles.size() > 0) - upd_ret = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_UPDATE), GetDesktopWindow(), DlgUpdate, (LPARAM)&UpdateFiles); + upd_ret = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_UPDATE), GetDesktopWindow(), DlgUpdate, (LPARAM)&UpdateFiles); DeleteFile(tszTmpIni); if (upd_ret == IDCANCEL) { hCheckThread = nullptr; diff --git a/plugins/PackUpdater/Src/stdafx.h b/plugins/PackUpdater/Src/stdafx.h index 3b86f1ee69..5df3de5503 100644 --- a/plugins/PackUpdater/Src/stdafx.h +++ b/plugins/PackUpdater/Src/stdafx.h @@ -27,7 +27,6 @@ Boston, MA 02111-1307, USA. #include // Miranda header files -#define __NO_CMPLUGIN_NEEDED #include #include #include @@ -52,6 +51,13 @@ Boston, MA 02111-1307, USA. #define DEFAULT_UPDATES_FOLDER L"Pack Updates" typedef std::wstring tString; +struct CMPlugin : public PLUGIN +{ + CMPlugin() : + PLUGIN(MODNAME) + {} +}; + struct FILEURL { wchar_t tszDownloadURL[2048]; @@ -90,7 +96,6 @@ struct FILEINFO using std::wstring; using namespace std; -extern HINSTANCE hInst; extern INT FileCount, CurrentFile, Number, UpdatesCount, Period; extern BOOL Silent, DlgDld; extern BYTE Reminder, UpdateOnStartup, UpdateOnPeriod, OnlyOnceADay, PeriodMeasure; -- cgit v1.2.3