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/LotusNotify/src | |
parent | 524d1c7186eca3f0a4da08548eeb919785227101 (diff) |
PLUGIN<> to half-automatically calculate the dll's g_hInstance and pass it inside
Diffstat (limited to 'plugins/LotusNotify/src')
-rw-r--r-- | plugins/LotusNotify/src/LotusNotify.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp index b9c5335b1c..8c105de7c7 100644 --- a/plugins/LotusNotify/src/LotusNotify.cpp +++ b/plugins/LotusNotify/src/LotusNotify.cpp @@ -23,7 +23,7 @@ INT_PTR SetStatus(WPARAM wParam, LPARAM lParam); char PLUGINNAME[64] = {0}; //init at init_pluginname();
int hLangpack = 0;
-HINSTANCE hInst;
+HINSTANCE g_hInstance;
CLIST_INTERFACE *pcli;
HINSTANCE hLotusDll;
@@ -209,7 +209,7 @@ void init_pluginname() WIN32_FIND_DATAA ffd;
// Try to find name of the file having original letter sizes
- GetModuleFileNameA(hInst, text, sizeof(text));
+ GetModuleFileNameA(g_hInstance, text, sizeof(text));
HANDLE hFind = FindFirstFileA(text, &ffd);
if(hFind != INVALID_HANDLE_VALUE) {
@@ -450,7 +450,7 @@ void showMsg(wchar_t* sender,wchar_t* text, DWORD id, char *strUID) POPUPATT * mpd = (POPUPATT*)malloc(sizeof(POPUPATT));
memset(&ppd, 0, sizeof(ppd)); //This is always a good thing to do.
ppd.lchContact = NULL; //(HANDLE)hContact; //Be sure to use a GOOD handle, since this will not be checked.
- ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON1));
+ ppd.lchIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ICON1));
wcscpy_s(ppd.lptzContactName, _countof(ppd.lptzContactName), sender);
wcscpy_s(ppd.lptzText, _countof(ppd.lptzText), text);
if(settingSetColours)
@@ -1453,7 +1453,7 @@ static INT_PTR CALLBACK DlgProcLotusNotifyMiscOpts(HWND hwndDlg, UINT msg, WPARA int LotusNotifyOptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
+ odp.hInstance = g_hInstance;
odp.szGroup.w = LPGENW("Plugins");
odp.szTitle.w = _A2W(__PLUGIN_NAME);
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
@@ -1509,7 +1509,7 @@ INT_PTR TMLoadIcon(WPARAM wParam, LPARAM) default:
return 0;
}
- return (INT_PTR)LoadImage(hInst, MAKEINTRESOURCE(id), IMAGE_ICON, GetSystemMetrics(wParam & PLIF_SMALL ? SM_CXSMICON : SM_CXICON), GetSystemMetrics(wParam & PLIF_SMALL ? SM_CYSMICON : SM_CYICON), 0);
+ 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);
}
@@ -1700,7 +1700,7 @@ extern "C" int __declspec(dllexport) Load(void) SET_UID(mi, 0x4519458, 0xb55a, 0x4e22, 0xac, 0x95, 0x5e, 0xa4, 0x4d, 0x92, 0x65, 0x65);
mi.position = -0x7FFFFFFF; //on top menu position
mi.flags = CMIF_UNICODE;
- mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON1));
+ mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ICON1));
mi.name.w = LPGENW("&Check Lotus");
mi.pszService = "LotusNotify/MenuCommand"; //service name thet listning for menu call
hMenuHandle = Menu_AddMainMenuItem(&mi); //create menu pos.
@@ -1760,7 +1760,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID ) case DLL_PROCESS_ATTACH:
/* Save the instance handle */
Plugin_Terminated = false;
- hInst = hinstDLL;
break;
case DLL_PROCESS_DETACH:
/* Deregister extension manager callbacks */
@@ -1773,12 +1772,14 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID ) /////////////////////////////////////////////////////////////////////////////////////////
-struct CMPlugin : public CMPluginBase
+struct CMPlugin : public PLUGIN<CMPlugin>
{
CMPlugin() :
- CMPluginBase(PLUGINNAME)
+ PLUGIN<CMPlugin>(PLUGINNAME)
{
RegisterProtocol(PROTOTYPE_PROTOCOL);
}
}
g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
|