summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorKirill Volinsky <Mataes2007@gmail.com>2018-05-16 13:47:00 +0300
committerKirill Volinsky <Mataes2007@gmail.com>2018-05-16 13:47:30 +0300
commit14bdd09684eb98da73a0fe46882f883f109841d6 (patch)
treeb195bb03c566afcdf1fa5aba9aab13fd79d645ef /plugins
parent51f216f7e0feb67ad21387219c1b90e42b14658d (diff)
AvatarHistory: cmplugin adaptation
Diffstat (limited to 'plugins')
-rw-r--r--plugins/AvatarHistory/src/AvatarDlg.cpp6
-rw-r--r--plugins/AvatarHistory/src/AvatarHistory.cpp13
-rw-r--r--plugins/AvatarHistory/src/icolib.cpp2
-rw-r--r--plugins/AvatarHistory/src/options.cpp2
-rw-r--r--plugins/AvatarHistory/src/popup.cpp2
-rw-r--r--plugins/AvatarHistory/src/stdafx.h10
6 files changed, 15 insertions, 20 deletions
diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp
index ed1bd5761b..262d0f60e3 100644
--- a/plugins/AvatarHistory/src/AvatarDlg.cpp
+++ b/plugins/AvatarHistory/src/AvatarDlg.cpp
@@ -66,7 +66,7 @@ public:
static void __cdecl AvatarDialogThread(AvatarDialogData *data)
{
- DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_AVATARDLG), data->parent, AvatarDlgProc, (LPARAM)data);
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_AVATARDLG), data->parent, AvatarDlgProc, (LPARAM)data);
}
int OpenAvatarDialog(MCONTACT hContact, char* fn)
@@ -190,7 +190,7 @@ static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARA
}
else break;
- HMENU menu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU1));
+ HMENU menu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_MENU1));
HMENU submenu = GetSubMenu(menu, 0);
TranslateMenu(submenu);
@@ -520,7 +520,7 @@ int ShowSaveDialog(HWND hwnd, wchar_t* fn, MCONTACT hContact)
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwnd;
- ofn.hInstance = hInst;
+ ofn.hInstance = g_plugin.getInst();
ofn.lpstrFilter = filter;
diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp
index 371e873281..46affc4d63 100644
--- a/plugins/AvatarHistory/src/AvatarHistory.cpp
+++ b/plugins/AvatarHistory/src/AvatarHistory.cpp
@@ -23,14 +23,13 @@ Avatar History Plugin
*/
#include "stdafx.h"
-HINSTANCE hInst;
-
DWORD mirVer;
HANDLE hFolder = nullptr;
wchar_t profilePath[MAX_PATH]; // database profile path (read at startup only)
wchar_t basedir[MAX_PATH];
+CMPlugin g_plugin;
int hLangpack = 0;
MWindowList hAvatarWindowsList = nullptr;
@@ -61,14 +60,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
}
/////////////////////////////////////////////////////////////////////////////////////////
-
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
// services
static INT_PTR GetCachedAvatar(WPARAM wParam, LPARAM lParam)
@@ -296,7 +287,7 @@ extern "C" __declspec(dllexport) int Load(void)
// Is first run?
if (db_get_b(NULL, MODULE_NAME, "FirstRun", 1)) {
// Show dialog
- int ret = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_FIRST_RUN), nullptr, FirstRunDlgProc, 0);
+ int ret = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FIRST_RUN), nullptr, FirstRunDlgProc, 0);
if (ret == 0)
return -1;
diff --git a/plugins/AvatarHistory/src/icolib.cpp b/plugins/AvatarHistory/src/icolib.cpp
index 38ce5a44a7..665cb0d867 100644
--- a/plugins/AvatarHistory/src/icolib.cpp
+++ b/plugins/AvatarHistory/src/icolib.cpp
@@ -38,7 +38,7 @@ int IcoLibIconsChanged(WPARAM, LPARAM)
void SetupIcoLib()
{
iconList[0].hIcolib = Skin_GetIconHandle(SKINICON_OTHER_HISTORY);
- Icon_Register(hInst, LPGEN("Avatar history"), iconList + 1, _countof(iconList) - 1);
+ Icon_Register(g_plugin.getInst(), LPGEN("Avatar history"), iconList + 1, _countof(iconList) - 1);
IcoLibUpdateMenus();
}
diff --git a/plugins/AvatarHistory/src/options.cpp b/plugins/AvatarHistory/src/options.cpp
index 7987f862a4..b0272797b6 100644
--- a/plugins/AvatarHistory/src/options.cpp
+++ b/plugins/AvatarHistory/src/options.cpp
@@ -147,7 +147,7 @@ static INT_PTR CALLBACK PopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
int OptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.szGroup.w = LPGENW("History"); // group to put your item under
odp.szTitle.w = LPGENW("Avatar"); // name of the item
odp.pfnDlgProc = OptionsDlgProc;
diff --git a/plugins/AvatarHistory/src/popup.cpp b/plugins/AvatarHistory/src/popup.cpp
index 2b5dfd3165..16e52cb53b 100644
--- a/plugins/AvatarHistory/src/popup.cpp
+++ b/plugins/AvatarHistory/src/popup.cpp
@@ -43,7 +43,7 @@ void InitPopups()
// window needed for popup commands
hPopupWindow = CreateWindowEx(WS_EX_TOOLWINDOW, L"static", _A2W(MODULE_NAME) L"_PopupWindow",
0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP,
- nullptr, hInst, nullptr);
+ nullptr, g_plugin.getInst(), nullptr);
SetWindowLongPtr(hPopupWindow, GWLP_WNDPROC, (LONG_PTR)PopupWndProc);
}
diff --git a/plugins/AvatarHistory/src/stdafx.h b/plugins/AvatarHistory/src/stdafx.h
index 28b882b8d9..d865398e6e 100644
--- a/plugins/AvatarHistory/src/stdafx.h
+++ b/plugins/AvatarHistory/src/stdafx.h
@@ -6,8 +6,6 @@
#include <ShObjIdl.h>
#include <ShlGuid.h>
-#define __NO_CMPLUGIN_NEEDED
-
#include <newpluginapi.h>
#include <m_clist.h>
#include <m_skin.h>
@@ -35,7 +33,6 @@
#include "popup.h"
// Globals
-extern HINSTANCE hInst;
extern HGENMENU hMenu;
extern DWORD mirVer;
extern MWindowList hAvatarWindowsList;
@@ -45,6 +42,13 @@ extern wchar_t basedir[];
#define MODULE_NAME "AvatarHistory"
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULE_NAME)
+ {}
+};
+
#define AVH_DEF_POPUPFG 0
#define AVH_DEF_POPUPBG 0x2DB6FF
#define AVH_DEF_AVPOPUPS 0