summaryrefslogtreecommitdiff
path: root/plugins/KeyboardNotify/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-05-17 20:50:08 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-05-17 20:50:08 +0300
commit523f3588b6f21adcc4bcf3ec3ffad05e2298863a (patch)
tree428f9611be9bfdba157f5c2056908ee02c9c7ce6 /plugins/KeyboardNotify/src
parent11e70d8c4e224d80015fffe0378c53abee5fd824 (diff)
KeyboardNotify, ListeningTo, MessageState, MirandaG15, MirFox, Msg_Export, MsgPopup, mTextControl => CMPlugin
Diffstat (limited to 'plugins/KeyboardNotify/src')
-rw-r--r--plugins/KeyboardNotify/src/main.cpp14
-rw-r--r--plugins/KeyboardNotify/src/options.cpp20
-rw-r--r--plugins/KeyboardNotify/src/stdafx.h9
3 files changed, 20 insertions, 23 deletions
diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp
index 091fe7d903..fe53b08299 100644
--- a/plugins/KeyboardNotify/src/main.cpp
+++ b/plugins/KeyboardNotify/src/main.cpp
@@ -26,10 +26,9 @@
#define NCONVERS_BLINKID ((MEVENT)123456) //nconvers' random identifier used to flash an icon for "incoming message" on contact list
-HINSTANCE g_hInst;
-
-CLIST_INTERFACE *pcli;
int hLangpack;
+CLIST_INTERFACE *pcli;
+CMPlugin g_plugin;
DWORD IDThread = 0;
HANDLE hThread = nullptr;
@@ -87,7 +86,8 @@ BOOL bReminderDisabled = FALSE;
BYTE bMetaProtoEnabled = 0;
-PLUGININFOEX pluginInfo = {
+PLUGININFOEX pluginInfo =
+{
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
@@ -105,12 +105,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
return &pluginInfo;
}
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- g_hInst = hinstDLL;
- return TRUE;
-}
-
int InitializeOptions(WPARAM, LPARAM);
BOOL CheckMsgWnd(MCONTACT, BOOL *);
diff --git a/plugins/KeyboardNotify/src/options.cpp b/plugins/KeyboardNotify/src/options.cpp
index 7425a67cc3..82518f2420 100644
--- a/plugins/KeyboardNotify/src/options.cpp
+++ b/plugins/KeyboardNotify/src/options.cpp
@@ -22,8 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
void LoadSettings(void);
-extern HINSTANCE g_hInst;
-
extern BYTE bFlashOnMsg, bFlashOnURL, bFlashOnFile, bFlashOnOther, bFullScreenMode, bScreenSaverRunning, bWorkstationLocked, bProcessesAreRunning,
bWorkstationActive, bFlashIfMsgOpen, bFlashIfMsgOlder, bFlashUntil, bMirandaOrWindows, bFlashLed[3], bFlashEffect, bSequenceOrder, bFlashSpeed,
bEmulateKeypresses, bOverride, bFlashIfMsgWinNotTop, bTrillianLedsMsg, bTrillianLedsURL, bTrillianLedsFile, bTrillianLedsOther;
@@ -725,11 +723,11 @@ static INT_PTR CALLBACK DlgProcBasicOptions(HWND hwndDlg, UINT msg, WPARAM wPara
}
return TRUE;
case IDC_ASSIGNPGMS:
- if (DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_PROCESSES), hwndDlg, DlgProcProcesses, 0) == IDC_OKPGM)
+ if (DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_PROCESSES), hwndDlg, DlgProcProcesses, 0) == IDC_OKPGM)
SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0);
return TRUE;
case IDC_SELECTXSTATUS:
- if (DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_XSTATUSES), hwndDlg, DlgProcXstatusList, 0) == IDC_OKXST)
+ if (DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_XSTATUSES), hwndDlg, DlgProcXstatusList, 0) == IDC_OKXST)
SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0);
return TRUE;
case IDC_SREMCHECK:
@@ -918,7 +916,7 @@ static INT_PTR CALLBACK DlgProcEffectOptions(HWND hwndDlg, UINT msg, WPARAM wPar
SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0);
return TRUE;
case IDC_ASSIGNLEDS:
- if (DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_EVENTLEDS), hwndDlg, DlgProcEventLeds, 0) == IDC_OK)
+ if (DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_EVENTLEDS), hwndDlg, DlgProcEventLeds, 0) == IDC_OK)
SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0);
return TRUE;
case IDC_SDELAY:
@@ -1307,20 +1305,20 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP
tci.pszText = TranslateT("Ignore");
TabCtrl_InsertItem(tc, 4, &tci);
- hwndProto = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_PROTO_OPTIONS), hwndDlg, DlgProcProtoOptions, (LPARAM)NULL);
+ hwndProto = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_PROTO_OPTIONS), hwndDlg, DlgProcProtoOptions, (LPARAM)NULL);
EnableThemeDialogTexture(hwndProto, ETDT_ENABLETAB);
SetWindowPos(hwndProto, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
ShowWindow(hwndProto, SW_SHOW);
- hwndBasic = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_BASIC_OPTIONS), hwndDlg, DlgProcBasicOptions, (LPARAM)NULL);
+ hwndBasic = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_BASIC_OPTIONS), hwndDlg, DlgProcBasicOptions, (LPARAM)NULL);
EnableThemeDialogTexture(hwndBasic, ETDT_ENABLETAB);
SetWindowPos(hwndBasic, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
- hwndEffect = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_EFFECT_OPTIONS), hwndDlg, DlgProcEffectOptions, (LPARAM)NULL);
+ hwndEffect = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_EFFECT_OPTIONS), hwndDlg, DlgProcEffectOptions, (LPARAM)NULL);
EnableThemeDialogTexture(hwndEffect, ETDT_ENABLETAB);
SetWindowPos(hwndEffect, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
- hwndTheme = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_THEME_OPTIONS), hwndDlg, DlgProcThemeOptions, (LPARAM)NULL);
+ hwndTheme = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_THEME_OPTIONS), hwndDlg, DlgProcThemeOptions, (LPARAM)NULL);
EnableThemeDialogTexture(hwndTheme, ETDT_ENABLETAB);
SetWindowPos(hwndTheme, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
- hwndIgnore = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_IGNORE_OPTIONS), hwndDlg, DlgProcIgnoreOptions, (LPARAM)NULL);
+ hwndIgnore = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_IGNORE_OPTIONS), hwndDlg, DlgProcIgnoreOptions, (LPARAM)NULL);
EnableThemeDialogTexture(hwndIgnore, ETDT_ENABLETAB);
SetWindowPos(hwndIgnore, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
hwndCurrentTab = hwndProto;
@@ -1386,7 +1384,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP
int InitializeOptions(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
odp.szTitle.a = LPGEN("Keyboard Flash");
odp.szGroup.a = LPGEN("Events");
diff --git a/plugins/KeyboardNotify/src/stdafx.h b/plugins/KeyboardNotify/src/stdafx.h
index 2b36b23ed0..992962837a 100644
--- a/plugins/KeyboardNotify/src/stdafx.h
+++ b/plugins/KeyboardNotify/src/stdafx.h
@@ -28,8 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <winioctl.h>
#include <Uxtheme.h>
-#define __NO_CMPLUGIN_NEEDED
-
#include <newpluginapi.h>
#include <m_database.h>
#include <m_options.h>
@@ -56,3 +54,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "keypresses.h"
#include "resource.h"
#include "version.h"
+
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(KEYBDMODULE)
+ {}
+};