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/IRCG/src/main.cpp | 15 ++++++++++----- protocols/IRCG/src/options.cpp | 4 ++-- protocols/IRCG/src/stdafx.h | 2 -- protocols/IRCG/src/userinfo.cpp | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) (limited to 'protocols/IRCG/src') diff --git a/protocols/IRCG/src/main.cpp b/protocols/IRCG/src/main.cpp index 8b4c3597ad..af7f13d4b5 100644 --- a/protocols/IRCG/src/main.cpp +++ b/protocols/IRCG/src/main.cpp @@ -22,10 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" #include "version.h" -CMPlugin g_plugin; CHAT_MANAGER *pci; CLIST_INTERFACE *pcli; -HINSTANCE g_hInstance; int hLangpack; @@ -49,16 +47,23 @@ PLUGININFOEX pluginInfo = __COPYRIGHT, __AUTHORWEB, UNICODE_AWARE, - {0x92382b4d, 0x5572, 0x48a0, {0xb0, 0xb9, 0x13, 0x36, 0xa6, 0x1, 0xd6, 0x89}} // {92382B4D-5572-48a0-B0B9-1336A601D689} + // {92382B4D-5572-48a0-B0B9-1336A601D689} + { 0x92382b4d, 0x5572, 0x48a0, {0xb0, 0xb9, 0x13, 0x36, 0xa6, 0x1, 0xd6, 0x89 }} }; -extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain; - extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) { return &pluginInfo; } +///////////////////////////////////////////////////////////////////////////////////////// + +CMPlugin g_plugin; + +extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain; + +///////////////////////////////////////////////////////////////////////////////////////// + extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST }; ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index 344999e511..dc4a82a630 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -204,7 +204,7 @@ static IconItem iconList[] = void InitIcons(void) { - Icon_Register(g_hInstance, "Protocols/IRC", iconList, _countof(iconList), "IRC"); + Icon_Register(g_plugin.getInst(), "Protocols/IRC", iconList, _countof(iconList), "IRC"); } HICON LoadIconEx(int iconId, bool big) @@ -1848,7 +1848,7 @@ void InitServers() wchar_t *szIniFile = Utils_ReplaceVarsW(L"%temp%\\default_servers.ini"); FILE *serverFile = _wfopen(szIniFile, L"a"); if (serverFile) { - char* pszSvrs = (char*)LockResource(LoadResource(g_hInstance, FindResource(g_hInstance, MAKEINTRESOURCE(IDR_SERVERS), L"TEXT"))); + char* pszSvrs = (char*)LockResource(LoadResource(g_plugin.getInst(), FindResource(g_plugin.getInst(), MAKEINTRESOURCE(IDR_SERVERS), L"TEXT"))); if (pszSvrs) fwrite(pszSvrs, 1, mir_strlen(pszSvrs) + 1, serverFile); fclose(serverFile); diff --git a/protocols/IRCG/src/stdafx.h b/protocols/IRCG/src/stdafx.h index 896d6a6097..fff9477127 100644 --- a/protocols/IRCG/src/stdafx.h +++ b/protocols/IRCG/src/stdafx.h @@ -200,8 +200,6 @@ using namespace irc; // Functions // main.cpp -extern HINSTANCE g_hInstance; - extern OBJLIST g_servers; CIrcProto* GetTimerOwner(UINT_PTR eventId); diff --git a/protocols/IRCG/src/userinfo.cpp b/protocols/IRCG/src/userinfo.cpp index c04c7036a9..56946ec121 100644 --- a/protocols/IRCG/src/userinfo.cpp +++ b/protocols/IRCG/src/userinfo.cpp @@ -212,7 +212,7 @@ int __cdecl CIrcProto::OnInitUserInfo(WPARAM wParam, LPARAM lParam) odp.flags = ODPF_DONTTRANSLATE; odp.szTitle.a = m_szModuleName; odp.dwInitParam = (LPARAM)this; - odp.hInstance = g_hInstance; + odp.hInstance = g_plugin.getInst(); odp.position = -1900000000; odp.pfnDlgProc = UserDetailsDlgProc; odp.pszTemplate = MAKEINTRESOURCEA(IDD_USERINFO); -- cgit v1.2.3