summaryrefslogtreecommitdiff
path: root/protocols/Sametime
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-04-18 18:14:33 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-04-18 18:14:33 +0300
commitb172c4bbc75cdad0e8ccd22292aa671ba43cac45 (patch)
tree4677a04a47f3987c88f3fb44c6b70d2642b1f8a3 /protocols/Sametime
parent524d1c7186eca3f0a4da08548eeb919785227101 (diff)
PLUGIN<> to half-automatically calculate the dll's g_hInstance and pass it inside
Diffstat (limited to 'protocols/Sametime')
-rw-r--r--protocols/Sametime/src/options.cpp2
-rw-r--r--protocols/Sametime/src/sametime.cpp13
-rw-r--r--protocols/Sametime/src/sametime.h2
-rw-r--r--protocols/Sametime/src/sametime_proto.cpp2
-rw-r--r--protocols/Sametime/src/sametime_session.cpp2
5 files changed, 8 insertions, 13 deletions
diff --git a/protocols/Sametime/src/options.cpp b/protocols/Sametime/src/options.cpp
index 188f0afd79..4c140e9f38 100644
--- a/protocols/Sametime/src/options.cpp
+++ b/protocols/Sametime/src/options.cpp
@@ -343,7 +343,7 @@ int CSametimeProto::OptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE | ODPF_DONTTRANSLATE;
- odp.hInstance = hInst;
+ odp.hInstance = g_hInstance;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTNET);
odp.szTitle.w = m_tszUserName;
odp.szGroup.w = LPGENW("Network");
diff --git a/protocols/Sametime/src/sametime.cpp b/protocols/Sametime/src/sametime.cpp
index e02d755a40..7e842b1501 100644
--- a/protocols/Sametime/src/sametime.cpp
+++ b/protocols/Sametime/src/sametime.cpp
@@ -17,16 +17,11 @@ PLUGININFOEX pluginInfo =
};
CMPlugin g_plugin;
-HINSTANCE hInst;
+HINSTANCE g_hInstance;
LIST<CSametimeProto> g_Instances(1, PtrKeySortT);
int hLangpack;
-// sametime.cpp: Defines the entry point for the DLL application.
-extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
-{
- hInst = hinstDLL;
- return TRUE;
-}
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
@@ -65,7 +60,7 @@ INT_PTR CSametimeProto::SametimeLoadIcon(WPARAM wParam, LPARAM lParam)
return NULL;
}
- return (INT_PTR) LoadImage(hInst, MAKEINTRESOURCE(id), IMAGE_ICON,
+ return (INT_PTR) LoadImage(g_hInstance, MAKEINTRESOURCE(id), IMAGE_ICON,
GetSystemMetrics(wParam & PLIF_SMALL ? SM_CXSMICON : SM_CXICON),
GetSystemMetrics(wParam & PLIF_SMALL ? SM_CYSMICON : SM_CYICON), 0);
}
@@ -84,7 +79,7 @@ static IconItem iconList[] =
void SametimeInitIcons(void)
{
- Icon_Register(hInst, "Protocols/Sametime", iconList, _countof(iconList), "SAMETIME");
+ Icon_Register(g_hInstance, "Protocols/Sametime", iconList, _countof(iconList), "SAMETIME");
}
HANDLE GetIconHandle(int iconId)
diff --git a/protocols/Sametime/src/sametime.h b/protocols/Sametime/src/sametime.h
index f5da14c480..9afa3230ad 100644
--- a/protocols/Sametime/src/sametime.h
+++ b/protocols/Sametime/src/sametime.h
@@ -105,7 +105,7 @@ typedef struct FileTransferClientData_tag {
// Global variables
struct CSametimeProto;
-extern HINSTANCE hInst;
+extern HINSTANCE g_hInstance;
extern PLUGININFOEX pluginInfo;
#include "sametime_proto.h"
diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp
index 382c941c51..d1c5a0dcfe 100644
--- a/protocols/Sametime/src/sametime_proto.cpp
+++ b/protocols/Sametime/src/sametime_proto.cpp
@@ -174,7 +174,7 @@ HWND CSametimeProto::SearchAdvanced(HWND owner)
HWND CSametimeProto::CreateExtendedSearchUI(HWND owner)
{
debugLogW(L"CSametimeProto::CreateExtendedSearchUI() start");
- return CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_USERSEARCH), owner, SearchDialogFunc, (LPARAM)this);
+ return CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_USERSEARCH), owner, SearchDialogFunc, (LPARAM)this);
}
diff --git a/protocols/Sametime/src/sametime_session.cpp b/protocols/Sametime/src/sametime_session.cpp
index 3646cc2f34..7f87cd8456 100644
--- a/protocols/Sametime/src/sametime_session.cpp
+++ b/protocols/Sametime/src/sametime_session.cpp
@@ -563,7 +563,7 @@ INT_PTR CSametimeProto::SessionAnnounce(WPARAM wParam, LPARAM lParam)
SessionAnnounceDialogProc_arg* sadpArg = (SessionAnnounceDialogProc_arg*)mir_calloc(sizeof(SessionAnnounceDialogProc_arg));
sadpArg->proto = this;
sadpArg->sendAnnouncementFunc = SendAnnouncement;
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SESSIONANNOUNCE), GetDesktopWindow(), SessionAnnounceDialogProc, (LPARAM)sadpArg);
+ CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_SESSIONANNOUNCE), GetDesktopWindow(), SessionAnnounceDialogProc, (LPARAM)sadpArg);
return 0;
}