diff options
author | George Hazan <ghazan@miranda.im> | 2018-04-18 20:51:18 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-04-18 20:51:18 +0300 |
commit | 9cf1444eb7888f2d942d220f938aa893396a8a1b (patch) | |
tree | ea87e4cb78e9c26a651af00b2d423324ce4a85a6 /protocols/FacebookRM | |
parent | 3936ebbc665c9653d9f62527c1e136944d52e2ca (diff) |
g_hInstance incapulated into PLUGIN<>, no need in the separate variable
Diffstat (limited to 'protocols/FacebookRM')
-rw-r--r-- | protocols/FacebookRM/src/captcha.cpp | 2 | ||||
-rw-r--r-- | protocols/FacebookRM/src/main.cpp | 12 | ||||
-rw-r--r-- | protocols/FacebookRM/src/proto.cpp | 6 | ||||
-rw-r--r-- | protocols/FacebookRM/src/stdafx.h | 1 | ||||
-rw-r--r-- | protocols/FacebookRM/src/theme.cpp | 2 |
5 files changed, 11 insertions, 12 deletions
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 <http://www.gnu.org/licenses/>. #include "stdafx.h"
-// TODO: Make following as "globals" structure?
-
-CMPlugin g_plugin;
int hLangpack;
-HINSTANCE g_hInstance;
std::string g_strUserAgent;
DWORD g_mirandaVersion;
@@ -51,6 +47,12 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda }
/////////////////////////////////////////////////////////////////////////////////////////
+
+CMPlugin g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+
+/////////////////////////////////////////////////////////////////////////////////////////
// Interface information
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
@@ -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<LPARAM>(data)); + HWND hDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_MIND), (HWND)nullptr, FBMindProc, reinterpret_cast<LPARAM>(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)
|