diff options
author | George Hazan <ghazan@miranda.im> | 2018-05-17 19:41:35 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-05-17 19:41:35 +0300 |
commit | 11e70d8c4e224d80015fffe0378c53abee5fd824 (patch) | |
tree | 8b21511f57aad4a9aaaa9391450cf5b83146a2f8 /plugins/SmileyAdd/src | |
parent | 0c12fe889baeced3e7d8c3f2558d10f563a43612 (diff) |
Popup, PManagerEx, QuickContacts, RemovePersonalSettings, Restart, SeenPlugin, SendSS, ShlExt, SimpleAR, SimpleStatusMsg, SkypeStatusChange, SmileyAdd, SMS => CMPlugin
Diffstat (limited to 'plugins/SmileyAdd/src')
-rw-r--r-- | plugins/SmileyAdd/src/dlgboxsubclass.cpp | 2 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/general.cpp | 2 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/main.cpp | 25 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/options.cpp | 2 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/richcall.cpp | 2 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/smltool.cpp | 8 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/stdafx.h | 9 |
7 files changed, 23 insertions, 27 deletions
diff --git a/plugins/SmileyAdd/src/dlgboxsubclass.cpp b/plugins/SmileyAdd/src/dlgboxsubclass.cpp index 884b323837..674e311427 100644 --- a/plugins/SmileyAdd/src/dlgboxsubclass.cpp +++ b/plugins/SmileyAdd/src/dlgboxsubclass.cpp @@ -155,7 +155,7 @@ int SmileyButtonCreate(WPARAM, LPARAM) desc.szSection.a = BB_HK_SECTION;
desc.szDescription.a = LPGEN("Smiley selector");
desc.DefHotKey = HOTKEYCODE(HOTKEYF_ALT, 'E');
- desc.lParam = LPARAM(g_hInst);
+ desc.lParam = LPARAM(g_plugin.getInst());
Hotkey_Register(&desc);
BBButton bbd = {};
diff --git a/plugins/SmileyAdd/src/general.cpp b/plugins/SmileyAdd/src/general.cpp index e23f1e835b..af943b4c4e 100644 --- a/plugins/SmileyAdd/src/general.cpp +++ b/plugins/SmileyAdd/src/general.cpp @@ -50,7 +50,7 @@ HICON GetDefaultIcon(bool copy) {
HICON resIco = IcoLib_GetIcon("SmileyAdd_ButtonSmiley");
if (resIco == nullptr)
- resIco = (HICON)LoadImage(g_hInst, MAKEINTRESOURCE(IDI_SMILINGICON), IMAGE_ICON, 0, 0, copy ? 0 : LR_SHARED);
+ resIco = (HICON)LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_SMILINGICON), IMAGE_ICON, 0, 0, copy ? 0 : LR_SHARED);
else if (copy) {
resIco = (HICON)CopyImage(resIco, IMAGE_ICON, 0, 0, 0);
IcoLib_Release("SmileyAdd_ButtonSmiley");
diff --git a/plugins/SmileyAdd/src/main.cpp b/plugins/SmileyAdd/src/main.cpp index 05698d2c75..0d936dec12 100644 --- a/plugins/SmileyAdd/src/main.cpp +++ b/plugins/SmileyAdd/src/main.cpp @@ -20,11 +20,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
// globals
-HINSTANCE g_hInst;
HANDLE hEvent1;
HGENMENU hContactMenuItem;
int hLangpack;
+CMPlugin g_plugin;
+
+/////////////////////////////////////////////////////////////////////////////////////////
static const PLUGININFOEX pluginInfoEx =
{
@@ -45,6 +47,8 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD /* mira return (PLUGININFOEX*)&pluginInfoEx;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
static IconItem icon = { LPGEN("Button smiley"), "SmileyAdd_ButtonSmiley", IDI_SMILINGICON };
static int ModulesLoaded(WPARAM, LPARAM)
@@ -91,7 +95,7 @@ extern "C" __declspec(dllexport) int Load(void) InitImageCache();
- Icon_Register(g_hInst, MODULENAME, &icon, 1);
+ Icon_Register(g_plugin.getInst(), MODULENAME, &icon, 1);
g_SmileyCategories.SetSmileyPackStore(&g_SmileyPacks);
@@ -125,6 +129,8 @@ extern "C" __declspec(dllexport) int Load(void) return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) int Unload(void)
{
RemoveDialogBoxHook();
@@ -142,18 +148,3 @@ extern "C" __declspec(dllexport) int Unload(void) DownloadClose();
return 0;
}
-
-extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID /*lpvReserved*/)
-{
- switch (fdwReason) {
- case DLL_PROCESS_ATTACH:
- g_hInst = hinstDLL;
- DisableThreadLibraryCalls(hinstDLL);
- break;
-
- case DLL_PROCESS_DETACH:
- break;
- }
-
- return TRUE;
-}
diff --git a/plugins/SmileyAdd/src/options.cpp b/plugins/SmileyAdd/src/options.cpp index de31cf1b8a..9f90a17076 100644 --- a/plugins/SmileyAdd/src/options.cpp +++ b/plugins/SmileyAdd/src/options.cpp @@ -655,7 +655,7 @@ int SmileysOptionsInitialize(WPARAM addInfo, LPARAM) {
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 910000000;
- odp.hInstance = g_hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SMILEYS);
odp.szTitle.a = LPGEN("Smileys");
odp.szGroup.a = LPGEN("Customize");
diff --git a/plugins/SmileyAdd/src/richcall.cpp b/plugins/SmileyAdd/src/richcall.cpp index a5a81e12cb..ed87211546 100644 --- a/plugins/SmileyAdd/src/richcall.cpp +++ b/plugins/SmileyAdd/src/richcall.cpp @@ -107,7 +107,7 @@ static void SetTooltip(long x, long y, HWND hwnd, RichEditData *rdt) if (needtip != -1) {
if (rdt->tipActive == -1) {
rdt->hToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, L"", TTS_NOPREFIX | WS_POPUP,
- CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwnd, nullptr, g_hInst, nullptr);
+ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwnd, nullptr, g_plugin.getInst(), nullptr);
SendMessage(rdt->hToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti);
}
diff --git a/plugins/SmileyAdd/src/smltool.cpp b/plugins/SmileyAdd/src/smltool.cpp index d264e314e4..8a74e9d753 100644 --- a/plugins/SmileyAdd/src/smltool.cpp +++ b/plugins/SmileyAdd/src/smltool.cpp @@ -552,7 +552,7 @@ void SmileyToolWindowType::InitDialog(LPARAM lParam) //add tooltips
m_hToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, L"",
- TTS_NOPREFIX | WS_POPUP, 0, 0, 0, 0, m_hwndDialog, nullptr, g_hInst, nullptr);
+ TTS_NOPREFIX | WS_POPUP, 0, 0, 0, 0, m_hwndDialog, nullptr, g_plugin.getInst(), nullptr);
TOOLINFO ti = { 0 };
ti.cbSize = sizeof(ti);
ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
@@ -748,7 +748,7 @@ void __cdecl SmileyToolThread(SmileyToolWindowParam *stwp) wndclass.lpfnWndProc = DlgProcSmileyToolWindow;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 4;
- wndclass.hInstance = g_hInst;
+ wndclass.hInstance = g_plugin.getInst();
wndclass.hIcon = nullptr;
wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
wndclass.hbrBackground = CreateSolidBrush(opt.SelWndBkgClr);
@@ -760,7 +760,7 @@ void __cdecl SmileyToolThread(SmileyToolWindowParam *stwp) CreateWindowEx(WS_EX_TOPMOST | WS_EX_NOPARENTNOTIFY, L"SmileyTool", nullptr,
WS_BORDER | WS_POPUP | WS_VISIBLE,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
- stwp->hWndParent, nullptr, g_hInst, stwp);
+ stwp->hWndParent, nullptr, g_plugin.getInst(), stwp);
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);
@@ -769,7 +769,7 @@ void __cdecl SmileyToolThread(SmileyToolWindowParam *stwp) TranslateMessage(&msg);
DispatchMessage(&msg);
}
- UnregisterClass(L"SmileyTool", g_hInst);
+ UnregisterClass(L"SmileyTool", g_plugin.getInst());
}
delete stwp;
}
diff --git a/plugins/SmileyAdd/src/stdafx.h b/plugins/SmileyAdd/src/stdafx.h index 22ac7afc7d..94092b9044 100644 --- a/plugins/SmileyAdd/src/stdafx.h +++ b/plugins/SmileyAdd/src/stdafx.h @@ -50,7 +50,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define NETLIB_NOLOGGING
-#define __NO_CMPLUGIN_NEEDED
#include <win2k.h>
#include <newpluginapi.h>
#include <m_clist.h>
@@ -88,7 +87,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "smileyroutines.h"
#include "smltool.h"
-extern HINSTANCE g_hInst;
extern HNETLIBUSER hNetlibUser;
extern HANDLE hEvent1;
extern HGENMENU hContactMenuItem;
@@ -98,6 +96,13 @@ extern LIST<void> menuHandleArray; #define MODULENAME "SmileyAdd"
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME)
+ {}
+};
+
#define DM_REMAKELOG (WM_USER + 11)
#define DM_OPTIONSAPPLIED (WM_USER + 14)
#define DM_APPENDTOLOG (WM_USER + 17)
|