From b172c4bbc75cdad0e8ccd22292aa671ba43cac45 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 18 Apr 2018 18:14:33 +0300 Subject: PLUGIN<> to half-automatically calculate the dll's g_hInstance and pass it inside --- plugins/GmailNotifier/src/main.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'plugins/GmailNotifier/src/main.cpp') 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() : - CMPluginBase(MODULE_NAME) + PLUGIN(MODULE_NAME) { RegisterProtocol(PROTOTYPE_VIRTUAL); } } g_plugin; + +extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain; -- cgit v1.2.3