summaryrefslogtreecommitdiff
path: root/plugins/Dbx_mdbx
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-05-17 21:37:53 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-05-17 21:37:53 +0300
commit88b04fed4966b0f1686690cb6101854afb52a5ee (patch)
tree79b4e574c0849f24907168075c8d0babfde2fde4 /plugins/Dbx_mdbx
parent5ebe9c34375bce857ad3160abba67d6ed2beadaf (diff)
Db3x_mmap, Dbx_mdbx, Exchange, MyDetails, RecentContacts, TopToolBar, WebView => CMPlugin
Diffstat (limited to 'plugins/Dbx_mdbx')
-rw-r--r--plugins/Dbx_mdbx/src/dbintf.cpp2
-rw-r--r--plugins/Dbx_mdbx/src/init.cpp3
-rw-r--r--plugins/Dbx_mdbx/src/stdafx.h10
-rw-r--r--plugins/Dbx_mdbx/src/ui.cpp4
-rw-r--r--plugins/Dbx_mdbx/src/ui.h8
5 files changed, 15 insertions, 12 deletions
diff --git a/plugins/Dbx_mdbx/src/dbintf.cpp b/plugins/Dbx_mdbx/src/dbintf.cpp
index 23d332ad8a..21c6c3a988 100644
--- a/plugins/Dbx_mdbx/src/dbintf.cpp
+++ b/plugins/Dbx_mdbx/src/dbintf.cpp
@@ -32,7 +32,7 @@ CDbxMDBX::CDbxMDBX(const TCHAR *tszFileName, int iMode) :
m_tszProfileName = mir_wstrdup(tszFileName);
if (!m_bReadOnly) {
- m_hwndTimer = CreateWindowExW(0, L"STATIC", nullptr, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, nullptr, g_hInst, nullptr);
+ m_hwndTimer = CreateWindowExW(0, L"STATIC", nullptr, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, nullptr, g_plugin.getInst(), nullptr);
::SetWindowLongPtr(m_hwndTimer, GWLP_USERDATA, (LONG_PTR)this);
}
diff --git a/plugins/Dbx_mdbx/src/init.cpp b/plugins/Dbx_mdbx/src/init.cpp
index 2500cd30ad..bedddf12fa 100644
--- a/plugins/Dbx_mdbx/src/init.cpp
+++ b/plugins/Dbx_mdbx/src/init.cpp
@@ -25,12 +25,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXTERN_C void NTAPI tls_callback(PVOID module, DWORD reason, PVOID reserved);
-HINSTANCE g_hInst = nullptr;
int hLangpack;
+CMPlugin g_plugin;
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD reason, LPVOID reserved)
{
- g_hInst = hInstDLL;
tls_callback(hInstDLL, reason, reserved);
return TRUE;
}
diff --git a/plugins/Dbx_mdbx/src/stdafx.h b/plugins/Dbx_mdbx/src/stdafx.h
index f394e09f3a..50031647f5 100644
--- a/plugins/Dbx_mdbx/src/stdafx.h
+++ b/plugins/Dbx_mdbx/src/stdafx.h
@@ -34,8 +34,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <map>
#include <cassert>
-#define __NO_CMPLUGIN_NEEDED
-
#include <newpluginapi.h>
#include <win2k.h>
#include <m_system_cpp.h>
@@ -164,6 +162,12 @@ public:
#include "resource.h"
#include "version.h"
-extern HINSTANCE g_hInst;
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(nullptr)
+ {}
+};
#include "ui.h"
+
diff --git a/plugins/Dbx_mdbx/src/ui.cpp b/plugins/Dbx_mdbx/src/ui.cpp
index a45fb02082..a7d9566dca 100644
--- a/plugins/Dbx_mdbx/src/ui.cpp
+++ b/plugins/Dbx_mdbx/src/ui.cpp
@@ -146,7 +146,7 @@ static INT_PTR ChangePassword(void* obj, WPARAM, LPARAM)
{
CDbxMDBX *db = (CDbxMDBX*)obj;
DlgChangePassParam param = { db };
- DialogBoxParam(g_hInst, MAKEINTRESOURCE(db->usesPassword() ? IDD_CHANGEPASS : IDD_NEWPASS), nullptr, sttChangePassword, (LPARAM)&param);
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(db->usesPassword() ? IDD_CHANGEPASS : IDD_NEWPASS), nullptr, sttChangePassword, (LPARAM)&param);
return 0;
}
@@ -182,7 +182,7 @@ static int OnModulesLoaded(PVOID obj, WPARAM, LPARAM)
{
CDbxMDBX *db = (CDbxMDBX*)obj;
- Icon_Register(g_hInst, LPGEN("Database"), iconList, _countof(iconList), "mdbx");
+ Icon_Register(g_plugin.getInst(), LPGEN("Database"), iconList, _countof(iconList), "mdbx");
HookEventObj(ME_OPT_INITIALISE, OnOptionsInit, db);
diff --git a/plugins/Dbx_mdbx/src/ui.h b/plugins/Dbx_mdbx/src/ui.h
index dc1a87c2e9..a76cedf625 100644
--- a/plugins/Dbx_mdbx/src/ui.h
+++ b/plugins/Dbx_mdbx/src/ui.h
@@ -40,7 +40,7 @@ class COptionsDialog : public CDlgBase
public:
COptionsDialog(CDbxMDBX *db) :
- CDlgBase(g_hInst, IDD_OPTIONS),
+ CDlgBase(g_plugin.getInst(), IDD_OPTIONS),
m_chkStandart(this, IDC_STANDARD),
m_chkTotal(this, IDC_TOTAL),
m_btnChangePass(this, IDC_USERPASS),
@@ -84,7 +84,7 @@ class CSelectCryptoDialog : public CDlgBase
public:
CSelectCryptoDialog(CRYPTO_PROVIDER **provs, size_t count) :
- CDlgBase(g_hInst, IDD_SELECT_CRYPTOPROVIDER),
+ CDlgBase(g_plugin.getInst(), IDD_SELECT_CRYPTOPROVIDER),
m_combo(this, IDC_SELECTCRYPT_COMBO),
m_descr(this, IDC_CRYPTOPROVIDER_DESCR),
m_chkTotalCrypt(this, IDC_CHECK_TOTALCRYPT),
@@ -146,7 +146,7 @@ class CEnterPasswordDialog : public CDlgBase
void OnInitDialog()
{
- m_header.SendMsg(WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(g_hInst, MAKEINTRESOURCE(iconList[0].defIconID)));
+ m_header.SendMsg(WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(iconList[0].defIconID)));
if (m_param->wrongPass)
{
if (m_param->wrongPass > 2)
@@ -180,7 +180,7 @@ class CEnterPasswordDialog : public CDlgBase
public:
CEnterPasswordDialog(DlgChangePassParam *param) :
- CDlgBase(g_hInst, IDD_LOGIN),
+ CDlgBase(g_plugin.getInst(), IDD_LOGIN),
m_header(this, IDC_HEADERBAR),
m_language(this, IDC_LANG),
m_passwordEdit(this, IDC_USERPASS),