diff options
author | George Hazan <ghazan@miranda.im> | 2018-05-17 17:09:50 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-05-17 17:09:50 +0300 |
commit | bce8bc74daf1c5f510404c8bdf956b41fb1c10fc (patch) | |
tree | 9879ad5ce5f42087558601af6a6f2827d7df4c39 /plugins/WhenWasIt/src | |
parent | ba1083b4da33ca44a5ae7d90eabbe3d6d340a81e (diff) |
WinterSpeak, WhoUsesMyFiles, WhenWasIt, wbOSD, Watrack_MPD -> CMPlugin
Diffstat (limited to 'plugins/WhenWasIt/src')
-rw-r--r-- | plugins/WhenWasIt/src/WhenWasIt.cpp | 16 | ||||
-rw-r--r-- | plugins/WhenWasIt/src/hooked_events.cpp | 2 | ||||
-rw-r--r-- | plugins/WhenWasIt/src/icons.cpp | 2 | ||||
-rw-r--r-- | plugins/WhenWasIt/src/notifiers.cpp | 4 | ||||
-rw-r--r-- | plugins/WhenWasIt/src/services.cpp | 8 | ||||
-rw-r--r-- | plugins/WhenWasIt/src/stdafx.h | 12 |
6 files changed, 25 insertions, 19 deletions
diff --git a/plugins/WhenWasIt/src/WhenWasIt.cpp b/plugins/WhenWasIt/src/WhenWasIt.cpp index c395ad5687..87de917e0e 100644 --- a/plugins/WhenWasIt/src/WhenWasIt.cpp +++ b/plugins/WhenWasIt/src/WhenWasIt.cpp @@ -20,15 +20,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
-char ModuleName[] = "WhenWasIt";
-HINSTANCE hInstance;
HWND hBirthdaysDlg = nullptr;
HWND hUpcomingDlg = nullptr;
MWindowList hAddBirthdayWndsList = nullptr;
+
+CMPlugin g_plugin;
int hLangpack;
CommonData commonData = { 0 };
+/////////////////////////////////////////////////////////////////////////////////////////
+
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
@@ -47,6 +49,8 @@ extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD) return &pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" int __declspec(dllexport) Load(void)
{
Log("%s", "Entering function " __FUNCTION__);
@@ -134,6 +138,8 @@ extern "C" int __declspec(dllexport) Load(void) return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" int __declspec(dllexport) Unload()
{
Log("%s", "Entering function " __FUNCTION__);
@@ -153,9 +159,3 @@ extern "C" int __declspec(dllexport) Unload() Log("%s", "Leaving function " __FUNCTION__);
return 0;
}
-
-bool WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInstance = hinstDLL;
- return TRUE;
-}
diff --git a/plugins/WhenWasIt/src/hooked_events.cpp b/plugins/WhenWasIt/src/hooked_events.cpp index c25bcc9eeb..7aa2881a96 100644 --- a/plugins/WhenWasIt/src/hooked_events.cpp +++ b/plugins/WhenWasIt/src/hooked_events.cpp @@ -44,7 +44,7 @@ static int OnOptionsInitialise(WPARAM wParam, LPARAM) {
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 100000000;
- odp.hInstance = hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_WWI);
odp.szTitle.w = LPGENW("Birthdays");
odp.szGroup.w = LPGENW("Contacts");
diff --git a/plugins/WhenWasIt/src/icons.cpp b/plugins/WhenWasIt/src/icons.cpp index 9cb6c49b3e..5b2092ced6 100644 --- a/plugins/WhenWasIt/src/icons.cpp +++ b/plugins/WhenWasIt/src/icons.cpp @@ -44,7 +44,7 @@ static HANDLE AddIcon(char *name, char *description, wchar_t *tszPath, int iDefa int AddIcons()
{
wchar_t tszPath[MAX_PATH];
- GetModuleFileName(hInstance, tszPath, _countof(tszPath));
+ GetModuleFileName(g_plugin.getInst(), tszPath, _countof(tszPath));
hCheckMenu = AddIcon("MenuCheck", LPGEN("Check birthdays menu item"), tszPath, IDI_CHECK);
hListMenu = AddIcon("MenuList", LPGEN("List birthdays menu item"), tszPath, IDI_LIST);
diff --git a/plugins/WhenWasIt/src/notifiers.cpp b/plugins/WhenWasIt/src/notifiers.cpp index ba5fc70842..ca672632c0 100644 --- a/plugins/WhenWasIt/src/notifiers.cpp +++ b/plugins/WhenWasIt/src/notifiers.cpp @@ -154,7 +154,7 @@ int DialogNotifyBirthday(MCONTACT hContact, int dtb, int age) wchar_t text[1024];
BuildDTBText(dtb, name, text, _countof(text));
if (!hUpcomingDlg) {
- hUpcomingDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_UPCOMING), nullptr, DlgProcUpcoming);
+ hUpcomingDlg = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_UPCOMING), nullptr, DlgProcUpcoming);
ShowWindow(hUpcomingDlg, commonData.bOpenInBackground ? SW_SHOWNOACTIVATE : SW_SHOW);
}
@@ -176,7 +176,7 @@ int DialogNotifyMissedBirthday(MCONTACT hContact, int dab, int age) wchar_t text[1024];
BuildDABText(dab, name, text, _countof(text));
if (!hUpcomingDlg) {
- hUpcomingDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_UPCOMING), nullptr, DlgProcUpcoming);
+ hUpcomingDlg = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_UPCOMING), nullptr, DlgProcUpcoming);
ShowWindow(hUpcomingDlg, commonData.bOpenInBackground ? SW_SHOWNOACTIVATE : SW_SHOW);
}
diff --git a/plugins/WhenWasIt/src/services.cpp b/plugins/WhenWasIt/src/services.cpp index 4a1c23b575..1790c0c8f6 100644 --- a/plugins/WhenWasIt/src/services.cpp +++ b/plugins/WhenWasIt/src/services.cpp @@ -139,7 +139,7 @@ INT_PTR CheckBirthdaysService(WPARAM, LPARAM lParam) INT_PTR ShowListService(WPARAM, LPARAM)
{
if (!hBirthdaysDlg)
- hBirthdaysDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_BIRTHDAYS), nullptr, DlgProcBirthdays);
+ hBirthdaysDlg = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_BIRTHDAYS), nullptr, DlgProcBirthdays);
ShowWindow(hBirthdaysDlg, SW_SHOW);
return 0;
@@ -149,7 +149,7 @@ INT_PTR AddBirthdayService(WPARAM hContact, LPARAM) {
HWND hWnd = WindowList_Find(hAddBirthdayWndsList, hContact);
if (!hWnd)
- hWnd = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_ADD_BIRTHDAY), nullptr, DlgProcAddBirthday, hContact);
+ hWnd = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ADD_BIRTHDAY), nullptr, DlgProcAddBirthday, hContact);
return ShowWindow(hWnd, SW_SHOW);
}
@@ -193,7 +193,7 @@ INT_PTR ImportBirthdaysService(WPARAM, LPARAM) wchar_t fileName[1024] = { 0 };
OPENFILENAME of = { 0 };
of.lStructSize = sizeof(OPENFILENAME);
- //of.hInstance = hInstance;
+ //of.g_plugin.getInst() = g_plugin.getInst();
wchar_t filter[MAX_PATH];
mir_snwprintf(filter, L"%s (*" BIRTHDAY_EXTENSION L")%c*" BIRTHDAY_EXTENSION L"%c", TranslateT("Birthdays files"), 0, 0);
of.lpstrFilter = filter;
@@ -218,7 +218,7 @@ INT_PTR ExportBirthdaysService(WPARAM, LPARAM) wchar_t fileName[1024] = { 0 };
OPENFILENAME of = { 0 };
of.lStructSize = sizeof(OPENFILENAME);
- //of.hInstance = hInstance;
+ //of.g_plugin.getInst() = g_plugin.getInst();
wchar_t filter[MAX_PATH];
mir_snwprintf(filter, L"%s (*" BIRTHDAY_EXTENSION L")%c*" BIRTHDAY_EXTENSION L"%c%s (*.*)%c*.*%c", TranslateT("Birthdays files"), 0, 0, TranslateT("All Files"), 0, 0);
of.lpstrFilter = filter;
diff --git a/plugins/WhenWasIt/src/stdafx.h b/plugins/WhenWasIt/src/stdafx.h index a562fb8890..f9bdc75670 100644 --- a/plugins/WhenWasIt/src/stdafx.h +++ b/plugins/WhenWasIt/src/stdafx.h @@ -29,7 +29,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <math.h>
#include <commctrl.h>
-#define __NO_CMPLUGIN_NEEDED
#include <newpluginapi.h>
#include <m_database.h>
#include <m_skin.h>
@@ -62,8 +61,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "dlg_handlers.h"
#include "events.h"
-extern char ModuleName[];
-extern HINSTANCE hInstance;
+#define ModuleName "WhenWasIt"
+
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(ModuleName)
+ {}
+};
+
extern HWND hBirthdaysDlg;
extern HWND hUpcomingDlg;
extern MWindowList hAddBirthdayWndsList;
|