summaryrefslogtreecommitdiff
path: root/plugins/mTextControl
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-05-17 20:50:08 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-05-17 20:50:08 +0300
commit523f3588b6f21adcc4bcf3ec3ffad05e2298863a (patch)
tree428f9611be9bfdba157f5c2056908ee02c9c7ce6 /plugins/mTextControl
parent11e70d8c4e224d80015fffe0378c53abee5fd824 (diff)
KeyboardNotify, ListeningTo, MessageState, MirandaG15, MirFox, Msg_Export, MsgPopup, mTextControl => CMPlugin
Diffstat (limited to 'plugins/mTextControl')
-rw-r--r--plugins/mTextControl/src/main.cpp14
-rw-r--r--plugins/mTextControl/src/richeditutils.cpp4
-rw-r--r--plugins/mTextControl/src/services.cpp2
-rw-r--r--plugins/mTextControl/src/stdafx.h11
-rw-r--r--plugins/mTextControl/src/textcontrol.cpp2
5 files changed, 18 insertions, 15 deletions
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 <tom.h>
#include <textserv.h>
-#define __NO_CMPLUGIN_NEEDED
-
#include <newpluginapi.h>
#include <m_database.h>
#include <m_langpack.h>
@@ -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>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(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);