summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-05-18 14:09:04 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-05-18 14:09:04 +0300
commit0f6d791bb25af9b70637601ebe50029cb69b2e75 (patch)
tree0a4d9deefab01bd1f14b3710293e4f21141f3c98 /src/mir_app
parent315179201a9f3ee4d048052613c9b5d85d3da9b4 (diff)
mir_app: CMPlugin introduced instead of g_hInst
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/src/FontOptions.cpp4
-rw-r--r--src/mir_app/src/addcontact.cpp2
-rw-r--r--src/mir_app/src/auth.cpp4
-rw-r--r--src/mir_app/src/button.cpp2
-rw-r--r--src/mir_app/src/chat_svc.cpp2
-rw-r--r--src/mir_app/src/clui.cpp2
-rw-r--r--src/mir_app/src/colorchooser.cpp2
-rw-r--r--src/mir_app/src/contacts.cpp2
-rw-r--r--src/mir_app/src/db_ini.cpp6
-rw-r--r--src/mir_app/src/ei_options.cpp6
-rw-r--r--src/mir_app/src/ei_services.cpp2
-rw-r--r--src/mir_app/src/enterstring.cpp4
-rw-r--r--src/mir_app/src/findadd.cpp4
-rw-r--r--src/mir_app/src/help.cpp8
-rw-r--r--src/mir_app/src/hotkey_opts.cpp2
-rw-r--r--src/mir_app/src/hotkeys.cpp4
-rw-r--r--src/mir_app/src/icolib.cpp2
-rw-r--r--src/mir_app/src/ignore.cpp2
-rw-r--r--src/mir_app/src/lpopts.cpp2
-rw-r--r--src/mir_app/src/menu_options.cpp2
-rw-r--r--src/mir_app/src/meta_addto.cpp2
-rw-r--r--src/mir_app/src/meta_edit.cpp2
-rw-r--r--src/mir_app/src/meta_main.cpp2
-rw-r--r--src/mir_app/src/meta_options.cpp2
-rw-r--r--src/mir_app/src/meta_services.cpp2
-rw-r--r--src/mir_app/src/miranda.cpp17
-rw-r--r--src/mir_app/src/miranda.h1
-rw-r--r--src/mir_app/src/netliblog.cpp2
-rw-r--r--src/mir_app/src/netlibopts.cpp2
-rw-r--r--src/mir_app/src/pluginopts.cpp4
-rw-r--r--src/mir_app/src/profilemanager.cpp10
-rw-r--r--src/mir_app/src/proto_opts.cpp6
-rw-r--r--src/mir_app/src/proto_order.cpp2
-rw-r--r--src/mir_app/src/searchresults.cpp2
-rw-r--r--src/mir_app/src/skin2opts.cpp6
-rw-r--r--src/mir_app/src/skinicons.cpp8
-rw-r--r--src/mir_app/src/sounds.cpp2
-rw-r--r--src/mir_app/src/srmm_base.cpp10
-rw-r--r--src/mir_app/src/srmm_toolbar.cpp2
-rw-r--r--src/mir_app/src/stdafx.h9
-rw-r--r--src/mir_app/src/visibility.cpp2
41 files changed, 84 insertions, 75 deletions
diff --git a/src/mir_app/src/FontOptions.cpp b/src/mir_app/src/FontOptions.cpp
index 6e3b97709a..823afc3955 100644
--- a/src/mir_app/src/FontOptions.cpp
+++ b/src/mir_app/src/FontOptions.cpp
@@ -983,7 +983,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
EffectInternal& E = effect_id_list_w2[itemData->effect_id];
FONTEFFECT es = E.value;
- if (IDOK == DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_CHOOSE_FONT_EFFECT), hwndDlg, ChooseEffectDlgProc, (LPARAM)&es)) {
+ if (IDOK == DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CHOOSE_FONT_EFFECT), hwndDlg, ChooseEffectDlgProc, (LPARAM)&es)) {
for (int i = 0; i < selCount; i++) {
itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0);
if (itemData->effect_id < 0)
@@ -1185,7 +1185,7 @@ int OptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = -790000000;
- odp.hInstance = g_hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FONTS);
odp.szTitle.a = LPGEN("Fonts and colors");
odp.szGroup.a = LPGEN("Customize");
diff --git a/src/mir_app/src/addcontact.cpp b/src/mir_app/src/addcontact.cpp
index 2d834fca55..d16544fa8c 100644
--- a/src/mir_app/src/addcontact.cpp
+++ b/src/mir_app/src/addcontact.cpp
@@ -51,7 +51,7 @@ protected:
public:
CAddContactDlg() :
- CDlgBase(g_hInst, IDD_ADDCONTACT),
+ CDlgBase(g_plugin, IDD_ADDCONTACT),
m_chkAdded(this, IDC_ADDED),
m_chkAuth(this, IDC_AUTH),
m_chkOpen(this, IDC_OPEN_WINDOW),
diff --git a/src/mir_app/src/auth.cpp b/src/mir_app/src/auth.cpp
index 014ed0cc27..dacbbe24ee 100644
--- a/src/mir_app/src/auth.cpp
+++ b/src/mir_app/src/auth.cpp
@@ -38,7 +38,7 @@ class CAuthReqDlg : public CDlgBase
public:
CAuthReqDlg(MEVENT hEvent) :
- CDlgBase(g_hInst, IDD_AUTHREQ),
+ CDlgBase(g_plugin, IDD_AUTHREQ),
m_hDbEvent(hEvent),
btnOk(this, IDOK),
btnCancel(this, IDCANCEL),
@@ -187,7 +187,7 @@ class CAddedDlg : public CDlgBase
public:
CAddedDlg(MEVENT hEvent) :
- CDlgBase(g_hInst, IDD_ADDED),
+ CDlgBase(g_plugin, IDD_ADDED),
m_hDbEvent(hEvent),
btnOk(this, IDOK),
btnAdd(this, IDC_ADD),
diff --git a/src/mir_app/src/button.cpp b/src/mir_app/src/button.cpp
index 6875846854..7a9ecc1e7f 100644
--- a/src/mir_app/src/button.cpp
+++ b/src/mir_app/src/button.cpp
@@ -468,7 +468,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
else {
TTooltips *ptt = (TTooltips*)mir_alloc(sizeof(TTooltips));
ptt->ThreadId = tt.ThreadId;
- ptt->hwnd = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, L"", TTS_ALWAYSTIP, 0, 0, 0, 0, nullptr, nullptr, g_hInst, nullptr);
+ ptt->hwnd = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, L"", TTS_ALWAYSTIP, 0, 0, 0, 0, nullptr, nullptr, g_plugin.getInst(), nullptr);
lToolTips.insert(ptt);
bct->hwndToolTips = ptt->hwnd;
}
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index 0984708610..e608868556 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -768,7 +768,7 @@ int LoadChatModule(void)
HookEvent(ME_FONT_RELOAD, FontsChanged);
HookEvent(ME_SKIN2_ICONSCHANGED, IconsChanged);
- g_hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_SRMM));
+ g_hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_SRMM));
TranslateMenu(g_hMenu);
bInited = true;
diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp
index 5da831c9de..cb86fe728d 100644
--- a/src/mir_app/src/clui.cpp
+++ b/src/mir_app/src/clui.cpp
@@ -169,7 +169,7 @@ static INT_PTR MenuItem_DeleteContact(WPARAM wParam, LPARAM lParam)
if (db_get_b(0, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT) && !(GetKeyState(VK_SHIFT) & 0x8000))
// Ask user for confirmation, and if the contact should be archived (hidden, not deleted)
- action = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_DELETECONTACT), (HWND)lParam, AskForConfirmationDlgProc, wParam);
+ action = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DELETECONTACT), (HWND)lParam, AskForConfirmationDlgProc, wParam);
else
action = IDYES;
diff --git a/src/mir_app/src/colorchooser.cpp b/src/mir_app/src/colorchooser.cpp
index befb73bbe8..95918e239d 100644
--- a/src/mir_app/src/colorchooser.cpp
+++ b/src/mir_app/src/colorchooser.cpp
@@ -86,7 +86,7 @@ class CColorChooserDlg : public CDlgBase
public:
CColorChooserDlg(CSrmmBaseDialog *pDlg, BOOL bFG, HWND hwndDlg, HWND hwndTarget, HWND hwndChooser) :
- CDlgBase(g_hInst, IDD_COLORCHOOSER),
+ CDlgBase(g_plugin, IDD_COLORCHOOSER),
m_text(this, IDC_COLORTEXT),
m_pDlg(pDlg),
m_hwndTarget(hwndTarget),
diff --git a/src/mir_app/src/contacts.cpp b/src/mir_app/src/contacts.cpp
index 2f52b6ca91..90b9daad1d 100644
--- a/src/mir_app/src/contacts.cpp
+++ b/src/mir_app/src/contacts.cpp
@@ -307,7 +307,7 @@ class CContactOptsDlg : public CDlgBase
public:
CContactOptsDlg() :
- CDlgBase(g_hInst, IDD_OPT_CONTACT),
+ CDlgBase(g_plugin, IDD_OPT_CONTACT),
m_nameOrder(this, IDC_NAMEORDER)
{
m_nameOrder.SetFlags(MTREE_DND);
diff --git a/src/mir_app/src/db_ini.cpp b/src/mir_app/src/db_ini.cpp
index d37a374e85..2b3c6c7606 100644
--- a/src/mir_app/src/db_ini.cpp
+++ b/src/mir_app/src/db_ini.cpp
@@ -51,7 +51,7 @@ public:
};
CInstallIniDlg::CInstallIniDlg(wchar_t *szIniPath)
- : CDlgBase(g_hInst, IDD_INSTALLINI),
+ : CDlgBase(g_plugin, IDD_INSTALLINI),
m_noToAll(this, IDC_NOTOALL), m_viewIni(this, IDC_VIEWINI),
m_iniName(this, IDC_ININAME), m_securityInfo(this, IDC_SECURITYINFO)
{
@@ -147,7 +147,7 @@ public:
};
CWarnIniChangeDlg::CWarnIniChangeDlg(warnSettingChangeInfo_t *warnInfo)
- : CDlgBase(g_hInst, IDD_WARNINICHANGE),
+ : CDlgBase(g_plugin, IDD_WARNINICHANGE),
m_yes(this, IDYES), m_no(this, IDNO),
m_cancel(this, IDCANCEL), m_noWarn(this, IDC_WARNNOMORE),
m_iniName(this, IDC_ININAME), m_settingName(this, IDC_SETTINGNAME),
@@ -224,7 +224,7 @@ void CIniImportDoneDlg::OnInitDialog()
}
CIniImportDoneDlg::CIniImportDoneDlg(wchar_t *path)
- : CDlgBase(g_hInst, IDD_INIIMPORTDONE),
+ : CDlgBase(g_plugin, IDD_INIIMPORTDONE),
m_delete(this, IDC_DELETE), m_leave(this, IDC_LEAVE),
m_recycle(this, IDC_RECYCLE), m_move(this, IDC_MOVE),
m_iniPath(this, IDC_ININAME), m_newPath(this, IDC_NEWNAME)
diff --git a/src/mir_app/src/ei_options.cpp b/src/mir_app/src/ei_options.cpp
index 7999b88b34..c21f37b4cf 100644
--- a/src/mir_app/src/ei_options.cpp
+++ b/src/mir_app/src/ei_options.cpp
@@ -219,7 +219,7 @@ class CExtraIconOptsDlg : public CDlgBase
hItem = m_tree.GetNextSibling(hItem);
}
- HMENU menu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_OPT_POPUP));
+ HMENU menu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_OPT_POPUP));
HMENU submenu = GetSubMenu(menu, popup);
TranslateMenu(submenu);
@@ -243,7 +243,7 @@ class CExtraIconOptsDlg : public CDlgBase
public:
CExtraIconOptsDlg() :
- CDlgBase(g_hInst, IDD_EI_OPTIONS),
+ CDlgBase(g_plugin, IDD_EI_OPTIONS),
m_tree(this, IDC_EXTRAORDER)
{
m_tree.SetFlags(MTREE_DND | MTREE_MULTISELECT);
@@ -261,7 +261,7 @@ public:
int cx = g_iIconSX;
HIMAGELIST hImageList = ImageList_Create(cx, cx, ILC_COLOR32 | ILC_MASK, 2, 2);
- HICON hBlankIcon = (HICON)LoadImage(g_hInst, MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, cx, cx, 0);
+ HICON hBlankIcon = (HICON)LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, cx, cx, 0);
ImageList_AddIcon(hImageList, hBlankIcon);
for (auto &extra : registeredExtraIcons) {
diff --git a/src/mir_app/src/ei_services.cpp b/src/mir_app/src/ei_services.cpp
index eccf9b9eea..58db24bada 100644
--- a/src/mir_app/src/ei_services.cpp
+++ b/src/mir_app/src/ei_services.cpp
@@ -487,7 +487,7 @@ void LoadExtraIconsModule()
hEventExtraImageListRebuilding = CreateHookableEvent(ME_CLIST_EXTRA_LIST_REBUILD);
// Icons
- Icon_Register(g_hInst, LPGEN("Contact list"), iconList, _countof(iconList));
+ Icon_Register(g_plugin.getInst(), LPGEN("Contact list"), iconList, _countof(iconList));
// Hooks
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
diff --git a/src/mir_app/src/enterstring.cpp b/src/mir_app/src/enterstring.cpp
index e831831e96..154ab51ba6 100644
--- a/src/mir_app/src/enterstring.cpp
+++ b/src/mir_app/src/enterstring.cpp
@@ -172,7 +172,7 @@ static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
return TRUE;
case WM_SIZE:
- Utils_ResizeDialog(hwndDlg, g_hInst, MAKEINTRESOURCEA(IDD_ENTER_STRING), sttEnterStringResizer);
+ Utils_ResizeDialog(hwndDlg, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_ENTER_STRING), sttEnterStringResizer);
break;
case WM_GETMINMAXINFO:
@@ -255,7 +255,7 @@ INT_PTR __cdecl svcEnterString(WPARAM, LPARAM lParam)
EnterStringFormParam param;
memcpy(&param, pForm, sizeof(ENTER_STRING));
- if (!DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_ENTER_STRING), GetForegroundWindow(), sttEnterStringDlgProc, LPARAM(&param)))
+ if (!DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ENTER_STRING), GetForegroundWindow(), sttEnterStringDlgProc, LPARAM(&param)))
return FALSE;
pForm->ptszResult = param.ptszResult;
diff --git a/src/mir_app/src/findadd.cpp b/src/mir_app/src/findadd.cpp
index fdadcd9b7c..da07067c41 100644
--- a/src/mir_app/src/findadd.cpp
+++ b/src/mir_app/src/findadd.cpp
@@ -432,7 +432,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
return TRUE;
case WM_SIZE:
- Utils_ResizeDialog(hwndDlg, g_hInst, MAKEINTRESOURCEA(IDD_FINDADD), FindAddDlgResizer, (LPARAM)dat);
+ Utils_ResizeDialog(hwndDlg, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_FINDADD), FindAddDlgResizer, (LPARAM)dat);
ReposTinySearchDlg(hwndDlg, dat);
SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, WM_SIZE, 0, 0);
if (dat->notSearchedYet) {
@@ -988,7 +988,7 @@ static INT_PTR FindAddCommand(WPARAM, LPARAM)
netProtoCount++;
}
if (netProtoCount > 0)
- hwndFindAdd = CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_FINDADD), nullptr, DlgProcFindAdd);
+ hwndFindAdd = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FINDADD), nullptr, DlgProcFindAdd);
}
return 0;
}
diff --git a/src/mir_app/src/help.cpp b/src/mir_app/src/help.cpp
index 3bf6f6d482..d4d547c162 100644
--- a/src/mir_app/src/help.cpp
+++ b/src/mir_app/src/help.cpp
@@ -36,7 +36,7 @@ class CAboutDlg : public CDlgBase
public:
CAboutDlg() :
- CDlgBase(g_hInst, IDD_ABOUT),
+ CDlgBase(g_plugin, IDD_ABOUT),
btnLink(this, IDC_CONTRIBLINK),
ctrlCredits(this, IDC_CREDITSFILE),
ctrlHeaderBar(this, IDC_HEADERBAR),
@@ -61,9 +61,9 @@ public:
Miranda_GetVersionText(productVersion, _countof(productVersion));
ctrlHeaderBar.SetText(CMStringW(FORMAT, L"Miranda NG\nv%S", productVersion));
- HRSRC hResInfo = FindResource(g_hInst, MAKEINTRESOURCE(IDR_CREDITS), L"TEXT");
- DWORD ResSize = SizeofResource(g_hInst, hResInfo);
- HGLOBAL hRes = LoadResource(g_hInst, hResInfo);
+ HRSRC hResInfo = FindResource(g_plugin.getInst(), MAKEINTRESOURCE(IDR_CREDITS), L"TEXT");
+ DWORD ResSize = SizeofResource(g_plugin.getInst(), hResInfo);
+ HGLOBAL hRes = LoadResource(g_plugin.getInst(), hResInfo);
char *pszMsg = (char*)LockResource(hRes);
if (pszMsg) {
char *pszMsgt = (char*)alloca(ResSize + 1);
diff --git a/src/mir_app/src/hotkey_opts.cpp b/src/mir_app/src/hotkey_opts.cpp
index 5b3c7dc21c..d0d495fa8b 100644
--- a/src/mir_app/src/hotkey_opts.cpp
+++ b/src/mir_app/src/hotkey_opts.cpp
@@ -1023,7 +1023,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
int HotkeyOptionsInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInst;
+ odp.hInstance = g_plugin.getInst();
odp.flags = ODPF_BOLDGROUPS;
odp.position = -180000000;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_HOTKEYS);
diff --git a/src/mir_app/src/hotkeys.cpp b/src/mir_app/src/hotkeys.cpp
index e6f74830aa..d82754d3b8 100644
--- a/src/mir_app/src/hotkeys.cpp
+++ b/src/mir_app/src/hotkeys.cpp
@@ -325,7 +325,7 @@ int LoadSkinHotkeys(void)
wcl.style = 0;
wcl.cbClsExtra = 0;
wcl.cbWndExtra = 0;
- wcl.hInstance = g_hInst;
+ wcl.hInstance = g_plugin.getInst();
wcl.hIcon = nullptr;
wcl.hCursor = LoadCursor(nullptr, IDC_ARROW);
wcl.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
@@ -336,7 +336,7 @@ int LoadSkinHotkeys(void)
g_pid = GetCurrentProcessId();
- g_hwndHotkeyHost = CreateWindow(L"MirandaHotkeyHostWnd", nullptr, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, nullptr, g_hInst, nullptr);
+ g_hwndHotkeyHost = CreateWindow(L"MirandaHotkeyHostWnd", nullptr, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, nullptr, g_plugin.getInst(), nullptr);
SetWindowPos(g_hwndHotkeyHost, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_HIDEWINDOW);
hhkKeyboard = SetWindowsHookEx(WH_KEYBOARD, sttKeyboardProc, nullptr, hMainThreadId);
diff --git a/src/mir_app/src/icolib.cpp b/src/mir_app/src/icolib.cpp
index b6c5405e81..4d735a09c3 100644
--- a/src/mir_app/src/icolib.cpp
+++ b/src/mir_app/src/icolib.cpp
@@ -785,7 +785,7 @@ int LoadIcoLibModule(void)
{
bModuleInitialized = TRUE;
- hIconBlank = LoadIconEx(g_hInst, MAKEINTRESOURCE(IDI_BLANK), 0);
+ hIconBlank = LoadIconEx(g_plugin.getInst(), MAKEINTRESOURCE(IDI_BLANK), 0);
hIcons2ChangedEvent = CreateHookableEvent(ME_SKIN2_ICONSCHANGED);
hIconsChangedEvent = CreateHookableEvent(ME_SKIN_ICONSCHANGED);
diff --git a/src/mir_app/src/ignore.cpp b/src/mir_app/src/ignore.cpp
index 86d60be867..4659f0ec99 100644
--- a/src/mir_app/src/ignore.cpp
+++ b/src/mir_app/src/ignore.cpp
@@ -328,7 +328,7 @@ static int IgnoreOptInitialise(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 900000000;
- odp.hInstance = g_hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_IGNORE);
odp.szTitle.a = LPGEN("Ignore");
odp.szGroup.a = LPGEN("Contacts");
diff --git a/src/mir_app/src/lpopts.cpp b/src/mir_app/src/lpopts.cpp
index c37af3109a..f32e71481f 100644
--- a/src/mir_app/src/lpopts.cpp
+++ b/src/mir_app/src/lpopts.cpp
@@ -69,7 +69,7 @@ public:
};
CLangpackDlg::CLangpackDlg()
- : CDlgBase(g_hInst, IDD_OPT_LANGUAGES),
+ : CDlgBase(g_plugin, IDD_OPT_LANGUAGES),
m_languages(this, IDC_LANGUAGES), m_infoFrame(this, IDC_LANGINFOFRAME),
m_authors(this, IDC_LANGAUTHORS),
m_locale(this, IDC_LANGLOCALE), m_lastModUsing(this, IDC_LANGMODUSING),
diff --git a/src/mir_app/src/menu_options.cpp b/src/mir_app/src/menu_options.cpp
index 51d1716f64..2845b0f3fa 100644
--- a/src/mir_app/src/menu_options.cpp
+++ b/src/mir_app/src/menu_options.cpp
@@ -268,7 +268,7 @@ class CGenMenuOptionsPage : public CDlgBase
public:
CGenMenuOptionsPage() :
- CDlgBase(g_hInst, IDD_OPT_GENMENU),
+ CDlgBase(g_plugin, IDD_OPT_GENMENU),
m_menuItems(this, IDC_MENUITEMS),
m_menuObjects(this, IDC_MENUOBJECTS),
m_radio1(this, IDC_RADIO1),
diff --git a/src/mir_app/src/meta_addto.cpp b/src/mir_app/src/meta_addto.cpp
index ff7a9b2dbe..eb61784393 100644
--- a/src/mir_app/src/meta_addto.cpp
+++ b/src/mir_app/src/meta_addto.cpp
@@ -124,7 +124,7 @@ public:
};
CMetaSelectDlg::CMetaSelectDlg(MCONTACT hContact)
- : CDlgBase(g_hInst, IDD_METASELECT), m_hContact(hContact),
+ : CDlgBase(g_plugin, IDD_METASELECT), m_hContact(hContact),
m_metaList(this, IDC_METALIST), m_sortCheck(this, IDC_CHK_SRT)
{
m_metaList.OnDblClick = Callback(this, &CMetaSelectDlg::MetaList_OnDblClick);
diff --git a/src/mir_app/src/meta_edit.cpp b/src/mir_app/src/meta_edit.cpp
index dfad6cdc13..9aea3770e0 100644
--- a/src/mir_app/src/meta_edit.cpp
+++ b/src/mir_app/src/meta_edit.cpp
@@ -446,6 +446,6 @@ static INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wPara
INT_PTR Meta_Edit(WPARAM wParam, LPARAM)
{
- DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_METAEDIT), cli.hwndContactList, Meta_EditDialogProc, (LPARAM)wParam);
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_METAEDIT), cli.hwndContactList, Meta_EditDialogProc, (LPARAM)wParam);
return 0;
}
diff --git a/src/mir_app/src/meta_main.cpp b/src/mir_app/src/meta_main.cpp
index e753ac4e57..06b3249d06 100644
--- a/src/mir_app/src/meta_main.cpp
+++ b/src/mir_app/src/meta_main.cpp
@@ -64,7 +64,7 @@ static int RegisterMeta(WPARAM, LPARAM)
int LoadMetacontacts(void)
{
- Icon_Register(g_hInst, LPGEN("MetaContacts"), iconList, _countof(iconList), "mc");
+ Icon_Register(g_plugin.getInst(), LPGEN("MetaContacts"), iconList, _countof(iconList), "mc");
db_set_resident(META_PROTO, "Status");
db_set_resident(META_PROTO, "IdleTS");
diff --git a/src/mir_app/src/meta_options.cpp b/src/mir_app/src/meta_options.cpp
index e70a563562..51c27b9b21 100644
--- a/src/mir_app/src/meta_options.cpp
+++ b/src/mir_app/src/meta_options.cpp
@@ -57,7 +57,7 @@ class CMetaOptionsDlg : public CDlgBase
public:
CMetaOptionsDlg() :
- CDlgBase(g_hInst, IDD_METAOPTIONS),
+ CDlgBase(g_plugin, IDD_METAOPTIONS),
m_btnUid(this, IDC_RAD_UID),
m_btnDid(this, IDC_RAD_DID),
m_btnMsg(this, IDC_RAD_MSG),
diff --git a/src/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp
index 135f979d8d..5ace38bbb4 100644
--- a/src/mir_app/src/meta_services.cpp
+++ b/src/mir_app/src/meta_services.cpp
@@ -111,7 +111,7 @@ INT_PTR Meta_LoadIcon(WPARAM wParam, LPARAM)
return 0;
}
- return (INT_PTR)LoadImage(g_hInst, MAKEINTRESOURCE(id), IMAGE_ICON,
+ return (INT_PTR)LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(id), IMAGE_ICON,
(wParam & PLIF_SMALL) ? g_iIconX : g_iIconSX,
(wParam & PLIF_SMALL) ? g_iIconY : g_iIconSY, 0);
}
diff --git a/src/mir_app/src/miranda.cpp b/src/mir_app/src/miranda.cpp
index dd484cb36c..ddb648ad60 100644
--- a/src/mir_app/src/miranda.cpp
+++ b/src/mir_app/src/miranda.cpp
@@ -50,12 +50,13 @@ ITaskbarList3 *pTaskbarInterface;
HANDLE hOkToExitEvent, hModulesLoadedEvent;
HANDLE hShutdownEvent, hPreShutdownEvent;
-HINSTANCE g_hInst;
DWORD hMainThreadId;
-int hLangpack = 0;
bool bModulesLoadedFired = false, bMirandaTerminated = false;
int g_iIconX, g_iIconY, g_iIconSX, g_iIconSY;
+CMPlugin g_plugin;
+int hLangpack = 0;
+
/////////////////////////////////////////////////////////////////////////////////////////
struct MWaitableObject
@@ -95,7 +96,9 @@ MIR_APP_DLL(void) Miranda_WaitOnHandle(MWaitableStub pFunc, HANDLE hEvent)
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID)
{
if (dwReason == DLL_PROCESS_ATTACH) {
- g_hInst = hinstDLL;
+ g_plugin.setInst(hinstDLL);
+ RegisterModule(&g_plugin);
+
g_iIconX = GetSystemMetrics(SM_CXICON);
g_iIconY = GetSystemMetrics(SM_CYICON);
g_iIconSX = GetSystemMetrics(SM_CXSMICON);
@@ -191,7 +194,7 @@ public:
};
CWaitRestartDlg::CWaitRestartDlg(HANDLE hProcess)
- : CDlgBase(g_hInst, IDD_WAITRESTART), m_timer(this, 1),
+ : CDlgBase(g_plugin, IDD_WAITRESTART), m_timer(this, 1),
m_progress(this, IDC_PROGRESSBAR), m_cancel(this, IDCANCEL)
{
m_autoClose = 0;
@@ -392,7 +395,7 @@ MIR_APP_DLL(bool) Miranda_OkToExit()
MIR_APP_DLL(DWORD) Miranda_GetVersion()
{
wchar_t filename[MAX_PATH];
- GetModuleFileName(g_hInst, filename, _countof(filename));
+ GetModuleFileName(g_plugin.getInst(), filename, _countof(filename));
DWORD unused, verInfoSize = GetFileVersionInfoSize(filename, &unused);
PVOID pVerInfo = _alloca(verInfoSize);
@@ -410,7 +413,7 @@ MIR_APP_DLL(DWORD) Miranda_GetVersion()
MIR_APP_DLL(void) Miranda_GetFileVersion(MFileVersion *pVer)
{
wchar_t filename[MAX_PATH];
- GetModuleFileName(g_hInst, filename, _countof(filename));
+ GetModuleFileName(g_plugin.getInst(), filename, _countof(filename));
DWORD unused, verInfoSize = GetFileVersionInfoSize(filename, &unused);
PVOID pVerInfo = _alloca(verInfoSize);
@@ -429,7 +432,7 @@ MIR_APP_DLL(void) Miranda_GetFileVersion(MFileVersion *pVer)
MIR_APP_DLL(void) Miranda_GetVersionText(char *pDest, size_t cbSize)
{
wchar_t filename[MAX_PATH], *productVersion;
- GetModuleFileName(g_hInst, filename, _countof(filename));
+ GetModuleFileName(g_plugin.getInst(), filename, _countof(filename));
DWORD unused, verInfoSize = GetFileVersionInfoSize(filename, &unused);
PVOID pVerInfo = _alloca(verInfoSize);
diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h
index 645fd36013..bc7a8e7797 100644
--- a/src/mir_app/src/miranda.h
+++ b/src/mir_app/src/miranda.h
@@ -63,7 +63,6 @@ void UninitIni(void);
/**** miranda.cpp **********************************************************************/
-extern HINSTANCE g_hInst;
extern DWORD hMainThreadId;
extern HANDLE hOkToExitEvent, hModulesLoadedEvent, hevLoadModule, hevUnloadModule;
extern HANDLE hAccListChanged;
diff --git a/src/mir_app/src/netliblog.cpp b/src/mir_app/src/netliblog.cpp
index 392f8dc4f3..1321955801 100644
--- a/src/mir_app/src/netliblog.cpp
+++ b/src/mir_app/src/netliblog.cpp
@@ -269,7 +269,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
void NetlibLogShowOptions(void)
{
if (logOptions.hwndOpts == nullptr)
- logOptions.hwndOpts = CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_NETLIBLOGOPTS), nullptr, LogOptionsDlgProc);
+ logOptions.hwndOpts = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_NETLIBLOGOPTS), nullptr, LogOptionsDlgProc);
SetForegroundWindow(logOptions.hwndOpts);
}
diff --git a/src/mir_app/src/netlibopts.cpp b/src/mir_app/src/netlibopts.cpp
index 2672778a9b..90edef4089 100644
--- a/src/mir_app/src/netlibopts.cpp
+++ b/src/mir_app/src/netlibopts.cpp
@@ -509,7 +509,7 @@ int NetlibOptInitialise(WPARAM wParam, LPARAM)
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 900000000;
- odp.hInstance = g_hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_NETLIB);
odp.szTitle.a = LPGEN("Network");
odp.pfnDlgProc = DlgProcNetlibOpts;
diff --git a/src/mir_app/src/pluginopts.cpp b/src/mir_app/src/pluginopts.cpp
index f2730dcfaa..a6d6209276 100644
--- a/src/mir_app/src/pluginopts.cpp
+++ b/src/mir_app/src/pluginopts.cpp
@@ -237,7 +237,7 @@ class CPluginOptDlg : public CDlgBase
public:
CPluginOptDlg() :
- CDlgBase(g_hInst, IDD_OPT_PLUGINS),
+ CDlgBase(g_plugin, IDD_OPT_PLUGINS),
m_link(this, IDC_GETMOREPLUGINS),
m_plugUrl(this, IDC_PLUGINURL, "https://miranda-ng.org/downloads/"),
m_author(this, IDC_PLUGINAUTHOR),
@@ -542,7 +542,7 @@ public:
int PluginOptionsInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pDialog = new CPluginOptDlg();
odp.position = 1300000000;
odp.szTitle.a = LPGEN("Plugins");
diff --git a/src/mir_app/src/profilemanager.cpp b/src/mir_app/src/profilemanager.cpp
index 07ae55e4a1..47a0474052 100644
--- a/src/mir_app/src/profilemanager.cpp
+++ b/src/mir_app/src/profilemanager.cpp
@@ -130,7 +130,7 @@ class CCreateProfileDlg : public CDlgBase
public:
CCreateProfileDlg(CCtrlButton &_btn, PROFILEMANAGERDATA *_pd) :
- CDlgBase(g_hInst, IDD_PROFILE_NEW),
+ CDlgBase(g_plugin, IDD_PROFILE_NEW),
m_btnOk(_btn),
m_pd(_pd),
m_bFocused(false),
@@ -431,7 +431,7 @@ class CChooseProfileDlg : public CDlgBase
public:
CChooseProfileDlg(CCtrlButton &_btn, PROFILEMANAGERDATA *_pd) :
- CDlgBase(g_hInst, IDD_PROFILE_SELECTION),
+ CDlgBase(g_plugin, IDD_PROFILE_SELECTION),
m_btnOk(_btn),
m_pd(_pd),
m_profileList(this, IDC_PROFILELIST)
@@ -569,7 +569,7 @@ class CProfileManager : public CDlgBase
public:
CProfileManager(PROFILEMANAGERDATA *_pd) :
- CDlgBase(g_hInst, IDD_PROFILEMANAGER),
+ CDlgBase(g_plugin, IDD_PROFILEMANAGER),
m_btnOk(this, IDOK),
m_pd(_pd),
m_tab(this, IDC_TABS),
@@ -585,8 +585,8 @@ public:
virtual void OnInitDialog()
{
// MUST NOT be replaced with Window_SetIcon_IcoLib!!!
- SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadImage(g_hInst, MAKEINTRESOURCE(IDI_DETAILSLOGO), IMAGE_ICON, g_iIconSX, g_iIconSY, 0));
- SendMessage(m_hwnd, WM_SETICON, ICON_BIG, (LPARAM)LoadImage(g_hInst, MAKEINTRESOURCE(IDI_DETAILSLOGO), IMAGE_ICON, g_iIconX, g_iIconY, 0));
+ SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_DETAILSLOGO), IMAGE_ICON, g_iIconSX, g_iIconSY, 0));
+ SendMessage(m_hwnd, WM_SETICON, ICON_BIG, (LPARAM)LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_DETAILSLOGO), IMAGE_ICON, g_iIconX, g_iIconY, 0));
if (m_pd->noProfiles || shouldAutoCreate(m_pd->ptszProfile))
m_tab.ActivatePage(1);
diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp
index 7b58a4abd0..be60116532 100644
--- a/src/mir_app/src/proto_opts.cpp
+++ b/src/mir_app/src/proto_opts.cpp
@@ -241,7 +241,7 @@ class CAccountManagerDlg : public CDlgBase
public:
CAccountManagerDlg() :
- CDlgBase(g_hInst, IDD_ACCMGR),
+ CDlgBase(g_plugin, IDD_ACCMGR),
m_accList(this, IDC_ACCLIST),
m_name(this, IDC_NAME),
m_link(this, IDC_LNK_ADDONS, "https://miranda-ng.org/"),
@@ -803,7 +803,7 @@ LRESULT CAccountListCtrl::CustomWndProc(UINT msg, WPARAM wParam, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
CAccountFormDlg::CAccountFormDlg(CAccountManagerDlg *pParent, int action, PROTOACCOUNT *pa) :
- CDlgBase(g_hInst, IDD_ACCFORM),
+ CDlgBase(g_plugin, IDD_ACCFORM),
m_btnOk(this, IDOK),
m_accName(this, IDC_ACCNAME),
m_prototype(this, IDC_PROTOTYPECOMBO),
@@ -948,7 +948,7 @@ void CAccountListCtrl::InitRename()
rc.bottom = rc.top + max(g_iIconSX, PARENT()->m_titleHeight) + 4 - 1;
++rc.top; --rc.right;
- m_hwndEdit = ::CreateWindow(L"EDIT", pa->tszAccountName, WS_CHILD | WS_BORDER | ES_AUTOHSCROLL, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, m_hwnd, nullptr, g_hInst, nullptr);
+ m_hwndEdit = ::CreateWindow(L"EDIT", pa->tszAccountName, WS_CHILD | WS_BORDER | ES_AUTOHSCROLL, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, m_hwnd, nullptr, g_plugin.getInst(), nullptr);
SetWindowLongPtr(m_hwndEdit, GWLP_USERDATA, (LPARAM)m_parentWnd);
mir_subclassWindow(m_hwndEdit, sttEditSubclassProc);
SendMessage(m_hwndEdit, WM_SETFONT, (WPARAM)PARENT()->m_hfntTitle, 0);
diff --git a/src/mir_app/src/proto_order.cpp b/src/mir_app/src/proto_order.cpp
index 4eefd4c359..2e7f0095b3 100644
--- a/src/mir_app/src/proto_order.cpp
+++ b/src/mir_app/src/proto_order.cpp
@@ -146,7 +146,7 @@ class CProtocolOrderOpts : public CDlgBase
public:
CProtocolOrderOpts() :
- CDlgBase(g_hInst, IDD_OPT_PROTOCOLORDER),
+ CDlgBase(g_plugin, IDD_OPT_PROTOCOLORDER),
m_order(this, IDC_PROTOCOLORDER),
m_btnReset(this, IDC_RESETPROTOCOLDATA),
m_bDragging(false),
diff --git a/src/mir_app/src/searchresults.cpp b/src/mir_app/src/searchresults.cpp
index 333e4c74fd..00a7a6618f 100644
--- a/src/mir_app/src/searchresults.cpp
+++ b/src/mir_app/src/searchresults.cpp
@@ -345,7 +345,7 @@ void ShowMoreOptionsMenu(HWND hwndDlg, int x, int y)
ListView_GetItem(GetDlgItem(hwndDlg, IDC_RESULTS), &lvi);
ListSearchResult *lsr = (ListSearchResult*)lvi.lParam;
- HMENU hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT));
+ HMENU hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_CONTEXT));
HMENU hPopupMenu = GetSubMenu(hMenu, 4);
TranslateMenu(hPopupMenu);
int commandId = TrackPopupMenu(hPopupMenu, TPM_RIGHTBUTTON | TPM_RETURNCMD, x, y, 0, hwndDlg, nullptr);
diff --git a/src/mir_app/src/skin2opts.cpp b/src/mir_app/src/skin2opts.cpp
index 2537ea6a6c..f6479cd92a 100644
--- a/src/mir_app/src/skin2opts.cpp
+++ b/src/mir_app/src/skin2opts.cpp
@@ -165,7 +165,7 @@ class CIconImportDlg : public CDlgBase
public:
CIconImportDlg(CIcoLibOptsDlg *_parent) :
- CDlgBase(g_hInst, IDD_ICOLIB_IMPORT),
+ CDlgBase(g_plugin, IDD_ICOLIB_IMPORT),
m_pParent(_parent),
m_preview(this, IDC_PREVIEW),
m_iconSet(this, IDC_ICONSET),
@@ -439,7 +439,7 @@ class CIcoLibOptsDlg : public CDlgBase
{
POINT pt;
GetCursorPos(&pt);
- HMENU hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_ICOLIB_CONTEXT));
+ HMENU hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_ICOLIB_CONTEXT));
HMENU hPopup = GetSubMenu(hMenu, 0);
TranslateMenu(hPopup);
int cmd = TrackPopupMenu(hPopup, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, nullptr);
@@ -545,7 +545,7 @@ class CIcoLibOptsDlg : public CDlgBase
public:
CIcoLibOptsDlg() :
- CDlgBase(g_hInst, IDD_OPT_ICOLIB),
+ CDlgBase(g_plugin, IDD_OPT_ICOLIB),
m_preview(this, IDC_PREVIEW),
m_btnImport(this, IDC_IMPORT),
m_urlGetMore(this, IDC_GETMORE, "https://miranda-ng.org/"),
diff --git a/src/mir_app/src/skinicons.cpp b/src/mir_app/src/skinicons.cpp
index 4ba68c2241..b0caa097bf 100644
--- a/src/mir_app/src/skinicons.cpp
+++ b/src/mir_app/src/skinicons.cpp
@@ -145,15 +145,15 @@ static HICON LoadSmallIcon(HINSTANCE hInstance, LPCTSTR lpIconName)
HICON LoadIconEx(HINSTANCE hInstance, LPCTSTR lpIconName, BOOL bShared)
{
HICON hResIcon = bShared ? LoadSmallIconShared(hInstance, lpIconName) : LoadSmallIcon(hInstance, lpIconName);
- if (hResIcon == nullptr && g_hInst != hInstance) // Icon not found in hInstance, let's try to load it from core
- hResIcon = bShared ? LoadSmallIconShared(g_hInst, lpIconName) : LoadSmallIcon(g_hInst, lpIconName);
+ if (hResIcon == nullptr && g_plugin.getInst() != hInstance) // Icon not found in hInstance, let's try to load it from core
+ hResIcon = bShared ? LoadSmallIconShared(g_plugin.getInst(), lpIconName) : LoadSmallIcon(g_plugin.getInst(), lpIconName);
return hResIcon;
}
int ImageList_AddIcon_NotShared(HIMAGELIST hIml, LPCTSTR szResource)
{
- HICON hTempIcon = LoadIconEx(g_hInst, szResource, 0);
+ HICON hTempIcon = LoadIconEx(g_plugin.getInst(), szResource, 0);
int res = ImageList_AddIcon(hIml, hTempIcon);
Safe_DestroyIcon(hTempIcon);
return res;
@@ -382,7 +382,7 @@ MIR_APP_DLL(HICON) Skin_LoadIcon(int idx, bool big)
int LoadSkinIcons(void)
{
wchar_t modulePath[MAX_PATH];
- GetModuleFileName(g_hInst, modulePath, _countof(modulePath));
+ GetModuleFileName(g_plugin.getInst(), modulePath, _countof(modulePath));
char iconName[MAX_PATH];
SKINICONDESC sid = {};
diff --git a/src/mir_app/src/sounds.cpp b/src/mir_app/src/sounds.cpp
index 877b67852e..bc359b8ca5 100644
--- a/src/mir_app/src/sounds.cpp
+++ b/src/mir_app/src/sounds.cpp
@@ -436,7 +436,7 @@ static int SkinOptionsInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = -200000000;
- odp.hInstance = g_hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SOUND);
odp.szTitle.a = LPGEN("Sounds");
odp.pfnDlgProc = DlgProcSoundOpts;
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp
index 18739c7732..c5ec59056b 100644
--- a/src/mir_app/src/srmm_base.cpp
+++ b/src/mir_app/src/srmm_base.cpp
@@ -28,8 +28,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "skin.h"
#include <m_history.h>
-CSrmmBaseDialog::CSrmmBaseDialog(HINSTANCE hInst, int idDialog, SESSION_INFO *si) :
- CDlgBase(hInst, idDialog),
+CSrmmBaseDialog::CSrmmBaseDialog(CMPluginBase &pPlugin, int idDialog, SESSION_INFO *si) :
+ CDlgBase(pPlugin, idDialog),
m_log(this, IDC_SRMM_LOG),
m_message(this, IDC_SRMM_MESSAGE),
m_nickList(this, IDC_SRMM_NICKLIST),
@@ -410,7 +410,7 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, SESSION_INFO *pa
hwndToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, nullptr,
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
- hwnd, nullptr, g_hInst, nullptr);
+ hwnd, nullptr, g_plugin.getInst(), nullptr);
}
RECT clientRect;
@@ -418,7 +418,7 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, SESSION_INFO *pa
TOOLINFO ti = { sizeof(ti) };
ti.uFlags = TTF_SUBCLASS;
- ti.hinst = g_hInst;
+ ti.hinst = g_plugin.getInst();
ti.hwnd = hwnd;
ti.uId = 1;
ti.rect = clientRect;
@@ -712,7 +712,7 @@ INT_PTR CSrmmBaseDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
wszText.Insert(0, L"mailto:");
if (pLink->msg == WM_RBUTTONDOWN) {
- HMENU hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT));
+ HMENU hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_CONTEXT));
HMENU hSubMenu = GetSubMenu(hMenu, 6);
TranslateMenu(hSubMenu);
diff --git a/src/mir_app/src/srmm_toolbar.cpp b/src/mir_app/src/srmm_toolbar.cpp
index 04877338b6..8a66992b52 100644
--- a/src/mir_app/src/srmm_toolbar.cpp
+++ b/src/mir_app/src/srmm_toolbar.cpp
@@ -601,7 +601,7 @@ class CSrmmToolbarOptions : public CDlgBase
public:
CSrmmToolbarOptions() :
- CDlgBase(g_hInst, IDD_OPT_TOOLBAR),
+ CDlgBase(g_plugin, IDD_OPT_TOOLBAR),
m_gap(this, IDC_SPIN1),
m_btnIM(this, IDC_IMCHECK),
m_btnChat(this, IDC_CHATCHECK),
diff --git a/src/mir_app/src/stdafx.h b/src/mir_app/src/stdafx.h
index 4919eefd98..e6c82f8609 100644
--- a/src/mir_app/src/stdafx.h
+++ b/src/mir_app/src/stdafx.h
@@ -103,4 +103,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
typedef struct GlobalLogSettingsBase GlobalLogSettings;
#include <m_chat_int.h>
-#include "resource.h" \ No newline at end of file
+#include "resource.h"
+
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(nullptr)
+ {}
+};
diff --git a/src/mir_app/src/visibility.cpp b/src/mir_app/src/visibility.cpp
index 77536c2c94..d12766845c 100644
--- a/src/mir_app/src/visibility.cpp
+++ b/src/mir_app/src/visibility.cpp
@@ -273,7 +273,7 @@ static int VisibilityOptInitialise(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 850000000;
- odp.hInstance = g_hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_VISIBILITY);
odp.szTitle.a = LPGEN("Visibility");
odp.szGroup.a = LPGEN("Contacts");