From 996fd46c8ef926f413b9860709cd891c20926141 Mon Sep 17 00:00:00 2001 From: Mataes Date: Tue, 15 May 2018 22:28:12 +0300 Subject: AddContact: cmplugin adaptation --- plugins/AddContactPlus/src/addcontact.cpp | 1 - plugins/AddContactPlus/src/main.cpp | 15 ++++----------- plugins/AddContactPlus/src/stdafx.h | 11 ++++++++--- 3 files changed, 12 insertions(+), 15 deletions(-) (limited to 'plugins/AddContactPlus/src') diff --git a/plugins/AddContactPlus/src/addcontact.cpp b/plugins/AddContactPlus/src/addcontact.cpp index a48157af37..5bb5c3212f 100644 --- a/plugins/AddContactPlus/src/addcontact.cpp +++ b/plugins/AddContactPlus/src/addcontact.cpp @@ -19,7 +19,6 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "stdafx.h" -#include struct AddDialogParam : public MZeroedObject { diff --git a/plugins/AddContactPlus/src/main.cpp b/plugins/AddContactPlus/src/main.cpp index 30611ab8aa..98e2538eb3 100644 --- a/plugins/AddContactPlus/src/main.cpp +++ b/plugins/AddContactPlus/src/main.cpp @@ -22,7 +22,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "stdafx.h" CLIST_INTERFACE *pcli; -HINSTANCE hInst; + +CMPlugin g_plugin; int hLangpack; static HANDLE hToolBarItem = nullptr; static HGENMENU hMainMenuItem = nullptr; @@ -53,21 +54,13 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) ///////////////////////////////////////////////////////////////////////////////////////// -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) -{ - hInst = hinstDLL; - return TRUE; -} - -///////////////////////////////////////////////////////////////////////////////////////// - static INT_PTR AddContactPlusDialog(WPARAM, LPARAM) { if (hAddDlg) { SetForegroundWindow(hAddDlg); SetFocus(hAddDlg); } - else hAddDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADDCONTACT), nullptr, AddContactDlgProc, 0); + else hAddDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ADDCONTACT), nullptr, AddContactDlgProc, 0); return 0; } @@ -145,7 +138,7 @@ extern "C" int __declspec(dllexport) Load(void) INITCOMMONCONTROLSEX icex = { sizeof(icex), ICC_USEREX_CLASSES }; InitCommonControlsEx(&icex); - Icon_Register(hInst, LPGEN("AddContact+"), &icon, 1); + Icon_Register(g_plugin.getInst(), LPGEN("AddContact+"), &icon, 1); HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); HookEvent(ME_PROTO_ACCLISTCHANGED, OnAccListChanged); diff --git a/plugins/AddContactPlus/src/stdafx.h b/plugins/AddContactPlus/src/stdafx.h index b1e2da7dfd..8626486757 100644 --- a/plugins/AddContactPlus/src/stdafx.h +++ b/plugins/AddContactPlus/src/stdafx.h @@ -23,8 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include - -#define __NO_CMPLUGIN_NEEDED +#include #include #include @@ -45,8 +44,14 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "resource.h" #include "version.h" +struct CMPlugin : public PLUGIN +{ + CMPlugin() : + PLUGIN("AddContact") + {} +}; + #define ICON_ADD "AddContactPlus_Icon" INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam); -extern HINSTANCE hInst; extern HWND hAddDlg; -- cgit v1.2.3