diff options
author | George Hazan <ghazan@miranda.im> | 2018-04-18 18:14:33 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-04-18 18:14:33 +0300 |
commit | b172c4bbc75cdad0e8ccd22292aa671ba43cac45 (patch) | |
tree | 4677a04a47f3987c88f3fb44c6b70d2642b1f8a3 /plugins/GmailNotifier | |
parent | 524d1c7186eca3f0a4da08548eeb919785227101 (diff) |
PLUGIN<> to half-automatically calculate the dll's g_hInstance and pass it inside
Diffstat (limited to 'plugins/GmailNotifier')
-rw-r--r-- | plugins/GmailNotifier/src/main.cpp | 14 | ||||
-rw-r--r-- | plugins/GmailNotifier/src/options.cpp | 2 | ||||
-rw-r--r-- | plugins/GmailNotifier/src/stdafx.h | 2 |
3 files changed, 7 insertions, 11 deletions
diff --git a/plugins/GmailNotifier/src/main.cpp b/plugins/GmailNotifier/src/main.cpp index 9dccc5965d..945ab5984d 100644 --- a/plugins/GmailNotifier/src/main.cpp +++ b/plugins/GmailNotifier/src/main.cpp @@ -11,7 +11,7 @@ There is no warranty. #include "version.h"
CLIST_INTERFACE *pcli;
-HINSTANCE hInst;
+HINSTANCE g_hInstance;
int hLangpack;
UINT hTimer;
HANDLE hMirandaStarted, hOptionsInitial;
@@ -56,12 +56,6 @@ INT_PTR GetName(WPARAM wParam, LPARAM lParam) return 0;
}
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD)
{
PluginMenuCommand(0, 0);
@@ -170,12 +164,14 @@ extern "C" int __declspec(dllexport) Unload(void) /////////////////////////////////////////////////////////////////////////////////////////
-struct CMPlugin : public CMPluginBase
+struct CMPlugin : public PLUGIN<CMPlugin>
{
CMPlugin() :
- CMPluginBase(MODULE_NAME)
+ PLUGIN<CMPlugin>(MODULE_NAME)
{
RegisterProtocol(PROTOTYPE_VIRTUAL);
}
}
g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
diff --git a/plugins/GmailNotifier/src/options.cpp b/plugins/GmailNotifier/src/options.cpp index cc2bd0ffa9..4aafb314f6 100644 --- a/plugins/GmailNotifier/src/options.cpp +++ b/plugins/GmailNotifier/src/options.cpp @@ -272,7 +272,7 @@ int OptInit(WPARAM wParam, LPARAM) {
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = -790000000;
- odp.hInstance = hInst;
+ odp.hInstance = g_hInstance;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT);
odp.szTitle.a = LPGEN("GmailNotifier");
odp.szGroup.a = LPGEN("Network");
diff --git a/plugins/GmailNotifier/src/stdafx.h b/plugins/GmailNotifier/src/stdafx.h index 78d5c08275..c098816cef 100644 --- a/plugins/GmailNotifier/src/stdafx.h +++ b/plugins/GmailNotifier/src/stdafx.h @@ -73,7 +73,7 @@ struct optionSettings extern OBJLIST<Account> g_accs;
extern optionSettings opt;
-extern HINSTANCE hInst;
+extern HINSTANCE g_hInstance;
extern HNETLIBUSER hNetlibUser;
extern UINT hTimer;
extern short ID_STATUS_NONEW;
|