From 523f3588b6f21adcc4bcf3ec3ffad05e2298863a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 17 May 2018 20:50:08 +0300 Subject: KeyboardNotify, ListeningTo, MessageState, MirandaG15, MirFox, Msg_Export, MsgPopup, mTextControl => CMPlugin --- plugins/mTextControl/src/main.cpp | 14 +++++++------- plugins/mTextControl/src/richeditutils.cpp | 4 ++-- plugins/mTextControl/src/services.cpp | 2 +- plugins/mTextControl/src/stdafx.h | 11 +++++++---- plugins/mTextControl/src/textcontrol.cpp | 2 +- 5 files changed, 18 insertions(+), 15 deletions(-) (limited to 'plugins/mTextControl/src') diff --git a/plugins/mTextControl/src/main.cpp b/plugins/mTextControl/src/main.cpp index 6c0a5d60a2..a710853b9c 100644 --- a/plugins/mTextControl/src/main.cpp +++ b/plugins/mTextControl/src/main.cpp @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -HINSTANCE hInst = nullptr; +CMPlugin g_plugin; int hLangpack; HMODULE hMsfteditDll = nullptr; @@ -29,6 +29,8 @@ HMODULE hMsfteditDll = nullptr; typedef HRESULT(WINAPI *pfnMyCreateTextServices)(IUnknown *punkOuter, ITextHost *pITextHost, IUnknown **ppUnk); pfnMyCreateTextServices MyCreateTextServices = nullptr; +///////////////////////////////////////////////////////////////////////////////////////// + PLUGININFOEX pluginInfoEx = { sizeof(PLUGININFOEX), @@ -43,17 +45,13 @@ PLUGININFOEX pluginInfoEx = { 0x69b9443b, 0xdc58, 0x4876, { 0xad, 0x39, 0xe3, 0xf4, 0x18, 0xa1, 0x33, 0xc5 } } }; -extern "C" 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); @@ -71,6 +69,8 @@ extern "C" __declspec(dllexport) int Load(void) return 0; } +///////////////////////////////////////////////////////////////////////////////////////// + extern "C" __declspec(dllexport) int Unload(void) { UnloadTextUsers(); diff --git a/plugins/mTextControl/src/richeditutils.cpp b/plugins/mTextControl/src/richeditutils.cpp index 650c596129..694be13db4 100644 --- a/plugins/mTextControl/src/richeditutils.cpp +++ b/plugins/mTextControl/src/richeditutils.cpp @@ -130,7 +130,7 @@ void LoadRichEdit() wcl.style = CS_GLOBALCLASS; wcl.cbClsExtra = 0; wcl.cbWndExtra = 0; - wcl.hInstance = hInst; + wcl.hInstance = g_plugin.getInst(); wcl.hIcon = nullptr; wcl.hCursor = LoadCursor(nullptr, IDC_ARROW); wcl.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH); @@ -147,7 +147,7 @@ void UnloadRichEdit() HWND CreateProxyWindow(ITextServices *ts) { - HWND hwnd = CreateWindow(L"NBRichEditProxyWndClass", L"", 0, 0, 0, 0, 0, nullptr, nullptr, hInst, nullptr); + HWND hwnd = CreateWindow(L"NBRichEditProxyWndClass", L"", 0, 0, 0, 0, 0, nullptr, nullptr, g_plugin.getInst(), nullptr); SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)ts); return hwnd; } diff --git a/plugins/mTextControl/src/services.cpp b/plugins/mTextControl/src/services.cpp index 162e87057a..c75673f918 100644 --- a/plugins/mTextControl/src/services.cpp +++ b/plugins/mTextControl/src/services.cpp @@ -328,7 +328,7 @@ INT_PTR MText_GetInterface(WPARAM, LPARAM lParam) if (MText == nullptr) return CALLSERVICE_NOTFOUND; - MText->version = pluginInfoEx.version; + MText->version = PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM); MText->Register = MTI_TextUserAdd; MText->Create = MTI_MTextCreateW; MText->CreateEx = MTI_MTextCreateEx; diff --git a/plugins/mTextControl/src/stdafx.h b/plugins/mTextControl/src/stdafx.h index 1adfef31b6..d669ffbc57 100644 --- a/plugins/mTextControl/src/stdafx.h +++ b/plugins/mTextControl/src/stdafx.h @@ -30,8 +30,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include -#define __NO_CMPLUGIN_NEEDED - #include #include #include @@ -55,7 +53,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #define MODULTITLE "Text Display" // globals -extern HINSTANCE hInst; -extern PLUGININFOEX pluginInfoEx; + +struct CMPlugin : public PLUGIN +{ + CMPlugin() : + PLUGIN(MODULNAME) + {} +}; #endif // __headers_h__ diff --git a/plugins/mTextControl/src/textcontrol.cpp b/plugins/mTextControl/src/textcontrol.cpp index b8f66ef432..a033bb1799 100644 --- a/plugins/mTextControl/src/textcontrol.cpp +++ b/plugins/mTextControl/src/textcontrol.cpp @@ -38,7 +38,7 @@ void MTextControl_RegisterClass() wcl.style = CS_GLOBALCLASS; wcl.cbClsExtra = 0; wcl.cbWndExtra = 0; - wcl.hInstance = hInst; + wcl.hInstance = g_plugin.getInst(); wcl.hIcon = nullptr; wcl.hCursor = LoadCursor(nullptr, IDC_ARROW); wcl.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH); -- cgit v1.2.3