summaryrefslogtreecommitdiff
path: root/protocols/MinecraftDynmap
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-04-18 20:51:18 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-04-18 20:51:18 +0300
commit9cf1444eb7888f2d942d220f938aa893396a8a1b (patch)
treeea87e4cb78e9c26a651af00b2d423324ce4a85a6 /protocols/MinecraftDynmap
parent3936ebbc665c9653d9f62527c1e136944d52e2ca (diff)
g_hInstance incapulated into PLUGIN<>, no need in the separate variable
Diffstat (limited to 'protocols/MinecraftDynmap')
-rw-r--r--protocols/MinecraftDynmap/src/dialogs.cpp4
-rw-r--r--protocols/MinecraftDynmap/src/main.cpp13
-rw-r--r--protocols/MinecraftDynmap/src/proto.cpp4
-rw-r--r--protocols/MinecraftDynmap/src/stdafx.h1
4 files changed, 8 insertions, 14 deletions
diff --git a/protocols/MinecraftDynmap/src/dialogs.cpp b/protocols/MinecraftDynmap/src/dialogs.cpp
index 20585717d0..6bedca6e8b 100644
--- a/protocols/MinecraftDynmap/src/dialogs.cpp
+++ b/protocols/MinecraftDynmap/src/dialogs.cpp
@@ -24,8 +24,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Icons
-extern HINSTANCE g_hInstance;
-
static IconItem icons[] = {
{ "proto", LPGEN("Protocol icon"), IDI_PROTO },
};
@@ -33,7 +31,7 @@ static IconItem icons[] = {
static HANDLE hIconLibItem[_countof(icons)];
void InitIcons(void) {
- Icon_Register(g_hInstance, "Protocols/MinecraftDynmap", icons, _countof(icons), "MinecraftDynmap");
+ Icon_Register(g_plugin.getInst(), "Protocols/MinecraftDynmap", icons, _countof(icons), "MinecraftDynmap");
}
HANDLE GetIconHandle(const char* name) {
diff --git a/protocols/MinecraftDynmap/src/main.cpp b/protocols/MinecraftDynmap/src/main.cpp
index 3c39f05077..d0edbe2b34 100644
--- a/protocols/MinecraftDynmap/src/main.cpp
+++ b/protocols/MinecraftDynmap/src/main.cpp
@@ -22,11 +22,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
-CMPlugin g_plugin;
CLIST_INTERFACE* pcli;
int hLangpack;
-HINSTANCE g_hInstance;
std::string g_strUserAgent;
DWORD g_mirandaVersion;
@@ -44,13 +42,12 @@ PLUGININFOEX pluginInfo = {
};
/////////////////////////////////////////////////////////////////////////////
-// Protocol instances
-DWORD WINAPI DllMain(HINSTANCE hInstance,DWORD,LPVOID)
-{
- g_hInstance = hInstance;
- return TRUE;
-}
+CMPlugin g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+
+/////////////////////////////////////////////////////////////////////////////
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
diff --git a/protocols/MinecraftDynmap/src/proto.cpp b/protocols/MinecraftDynmap/src/proto.cpp
index ea486cc3a7..871cc511f3 100644
--- a/protocols/MinecraftDynmap/src/proto.cpp
+++ b/protocols/MinecraftDynmap/src/proto.cpp
@@ -153,7 +153,7 @@ int MinecraftDynmapProto::OnEvent(PROTOEVENTTYPE event,WPARAM wParam,LPARAM lPar
INT_PTR MinecraftDynmapProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam)
{
- return (INT_PTR)CreateDialogParam(g_hInstance,MAKEINTRESOURCE(IDD_MinecraftDynmapACCOUNT), (HWND)lParam, MinecraftDynmapAccountProc, (LPARAM)this);
+ return (INT_PTR)CreateDialogParam(g_plugin.getInst(),MAKEINTRESOURCE(IDD_MinecraftDynmapACCOUNT), (HWND)lParam, MinecraftDynmapAccountProc, (LPARAM)this);
}
int MinecraftDynmapProto::OnModulesLoaded(WPARAM, LPARAM)
@@ -170,7 +170,7 @@ int MinecraftDynmapProto::OnModulesLoaded(WPARAM, LPARAM)
/*int MinecraftDynmapProto::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;
diff --git a/protocols/MinecraftDynmap/src/stdafx.h b/protocols/MinecraftDynmap/src/stdafx.h
index e164bf1c39..7613c4181d 100644
--- a/protocols/MinecraftDynmap/src/stdafx.h
+++ b/protocols/MinecraftDynmap/src/stdafx.h
@@ -71,6 +71,5 @@ class MinecraftDynmapProto;
#include "dialogs.h"
#include "resource.h"
-extern HINSTANCE g_hInstance;
extern std::string g_strUserAgent;
extern DWORD g_mirandaVersion;