From 0c2b7724eba7cd5e35cf8c3b58b1f1a42fa1c288 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Wed, 16 May 2018 17:06:38 +0300 Subject: Boltun: cmplugin adaptation --- plugins/Boltun/src/boltun.cpp | 18 ++++++------------ plugins/Boltun/src/stdafx.h | 9 +++++++-- 2 files changed, 13 insertions(+), 14 deletions(-) (limited to 'plugins') diff --git a/plugins/Boltun/src/boltun.cpp b/plugins/Boltun/src/boltun.cpp index 09e2949a95..00188261de 100644 --- a/plugins/Boltun/src/boltun.cpp +++ b/plugins/Boltun/src/boltun.cpp @@ -20,6 +20,7 @@ #include "stdafx.h" +CMPlugin g_plugin; int hLangpack; TalkBot* bot = nullptr; @@ -27,7 +28,6 @@ TalkBot* bot = nullptr; #define MAX_WARN_TEXT 1024 #define MAX_MIND_FILE 1024 -HINSTANCE hInst; BOOL blInit = FALSE; UINT pTimer = 0; wchar_t tszPath[MAX_PATH]; @@ -115,17 +115,17 @@ static bool LoadMind(const wchar_t* filename, int &line) //exit(0); #endif SetCursor(oldCur); - HRSRC hRes = FindResource(hInst, MAKEINTRESOURCE(IDR_SMILES), L"SMILES"); + HRSRC hRes = FindResource(g_plugin.getInst(), MAKEINTRESOURCE(IDR_SMILES), L"SMILES"); if (!hRes) { delete mind; return false; } - DWORD size = SizeofResource(hInst, hRes); + DWORD size = SizeofResource(g_plugin.getInst(), hRes); if (!size) { delete mind; return false; } - HGLOBAL hGlob = LoadResource(hInst, hRes); + HGLOBAL hGlob = LoadResource(g_plugin.getInst(), hRes); if (!hGlob) { delete mind; return false; @@ -223,12 +223,6 @@ static int MessageEventAdded(WPARAM hContact, LPARAM hDbEvent) return 0; } -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) -{ - hInst = hinstDLL; - return TRUE; -} - void UpdateEverybodyCheckboxes(HWND hwndDlg) { bool Enable = BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_EVERYBODY) == BST_CHECKED; @@ -441,7 +435,7 @@ static int MessageOptInit(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; odp.position = 910000000; - odp.hInstance = hInst; + odp.hInstance = g_plugin.getInst(); odp.szGroup.a = BOLTUN_GROUP; odp.szTitle.a = BOLTUN_NAME; odp.pfnDlgProc = MainDlgProc; @@ -528,7 +522,7 @@ extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfo); - GetModuleFileName(hInst, tszPath, _countof(tszPath)); + GetModuleFileName(g_plugin.getInst(), tszPath, _countof(tszPath)); *(wcsrchr(tszPath, '\\') + 1) = '\0'; /*initialize miranda hooks and services on options dialog*/ diff --git a/plugins/Boltun/src/stdafx.h b/plugins/Boltun/src/stdafx.h index 5fb0955d9d..03f9929561 100644 --- a/plugins/Boltun/src/stdafx.h +++ b/plugins/Boltun/src/stdafx.h @@ -30,8 +30,6 @@ #include #include -#define __NO_CMPLUGIN_NEEDED - #include #include #include @@ -53,6 +51,13 @@ #define BOLTUN_KEY "Boltun" +struct CMPlugin : public PLUGIN +{ + CMPlugin() : + PLUGIN(BOLTUN_KEY) + {} +}; + //Service names #define SERV_CONTACT_AUTO_CHAT "Boltun/ContactAutoChat" #define SERV_CONTACT_NOT_TO_CHAT "Boltun/ContactNotToChat" -- cgit v1.2.3