From 9cf1444eb7888f2d942d220f938aa893396a8a1b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 18 Apr 2018 20:51:18 +0300 Subject: g_hInstance incapulated into PLUGIN<>, no need in the separate variable --- protocols/FacebookRM/src/captcha.cpp | 2 +- protocols/FacebookRM/src/main.cpp | 12 ++++++------ protocols/FacebookRM/src/proto.cpp | 6 +++--- protocols/FacebookRM/src/stdafx.h | 1 - protocols/FacebookRM/src/theme.cpp | 2 +- 5 files changed, 11 insertions(+), 12 deletions(-) (limited to 'protocols/FacebookRM/src') diff --git a/protocols/FacebookRM/src/captcha.cpp b/protocols/FacebookRM/src/captcha.cpp index 96f13447d5..4ab92bd91b 100644 --- a/protocols/FacebookRM/src/captcha.cpp +++ b/protocols/FacebookRM/src/captcha.cpp @@ -126,7 +126,7 @@ bool FacebookProto::RunCaptchaForm(std::string captchaUrl, std::string &result) GetObject(param.bmp, sizeof(bmp), &bmp); param.w = bmp.bmWidth; param.h = bmp.bmHeight; - int res = DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CAPTCHAFORM), nullptr, CaptchaFormDlgProc, (LPARAM)¶m); + int res = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CAPTCHAFORM), nullptr, CaptchaFormDlgProc, (LPARAM)¶m); if (res == 0) return false; diff --git a/protocols/FacebookRM/src/main.cpp b/protocols/FacebookRM/src/main.cpp index a2d89766aa..cb1d42f23b 100644 --- a/protocols/FacebookRM/src/main.cpp +++ b/protocols/FacebookRM/src/main.cpp @@ -22,12 +22,8 @@ along with this program. If not, see . #include "stdafx.h" -// TODO: Make following as "globals" structure? - -CMPlugin g_plugin; int hLangpack; -HINSTANCE g_hInstance; std::string g_strUserAgent; DWORD g_mirandaVersion; @@ -50,6 +46,12 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda return &pluginInfo; } +///////////////////////////////////////////////////////////////////////////////////////// + +CMPlugin g_plugin; + +extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain; + ///////////////////////////////////////////////////////////////////////////////////////// // Interface information @@ -91,5 +93,3 @@ extern "C" int __declspec(dllexport) Unload(void) { return 0; } - -extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain; diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index f8c66e68b5..61b3d8de79 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -415,7 +415,7 @@ int FacebookProto::OnEvent(PROTOEVENTTYPE event, WPARAM wParam, LPARAM lParam) INT_PTR FacebookProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam) { - return (INT_PTR)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_FACEBOOKACCOUNT), + return (INT_PTR)CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FACEBOOKACCOUNT), (HWND)lParam, FBAccountProc, (LPARAM)this); } @@ -442,7 +442,7 @@ int FacebookProto::OnPreShutdown(WPARAM, LPARAM) int FacebookProto::OnOptionsInit(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; - odp.hInstance = g_hInstance; + odp.hInstance = g_plugin.getInst(); odp.szTitle.w = m_tszUserName; odp.dwInitParam = LPARAM(this); odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE | ODPF_DONTTRANSLATE; @@ -516,7 +516,7 @@ INT_PTR FacebookProto::OnMind(WPARAM wParam, LPARAM) for (auto &iter : facy.pages) data->walls.push_back(new wall_data(iter.first, mir_utf8decodeW(iter.second.c_str()), true)); - HWND hDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_MIND), (HWND)nullptr, FBMindProc, reinterpret_cast(data)); + HWND hDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_MIND), (HWND)nullptr, FBMindProc, reinterpret_cast(data)); ShowWindow(hDlg, SW_SHOW); return 0; diff --git a/protocols/FacebookRM/src/stdafx.h b/protocols/FacebookRM/src/stdafx.h index 5d6a51b0ac..f41eb6c7f1 100644 --- a/protocols/FacebookRM/src/stdafx.h +++ b/protocols/FacebookRM/src/stdafx.h @@ -80,7 +80,6 @@ class FacebookProto; #include "resource.h" #include "version.h" -extern HINSTANCE g_hInstance; extern std::string g_strUserAgent; extern DWORD g_mirandaVersion; diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp index ce5fb25df3..71fb869c95 100644 --- a/protocols/FacebookRM/src/theme.cpp +++ b/protocols/FacebookRM/src/theme.cpp @@ -54,7 +54,7 @@ static IconItem icons[] = void InitIcons(void) { - Icon_Register(g_hInstance, "Protocols/Facebook", icons, _countof(icons), "Facebook"); + Icon_Register(g_plugin.getInst(), "Protocols/Facebook", icons, _countof(icons), "Facebook"); } HANDLE GetIconHandle(const char* name) -- cgit v1.2.3