diff options
author | Mataes <mataes2007@gmail.com> | 2018-05-16 19:12:38 +0300 |
---|---|---|
committer | Mataes <mataes2007@gmail.com> | 2018-05-16 19:12:38 +0300 |
commit | b12321b9897b511e94301b73c1c48c533412d739 (patch) | |
tree | aeec4c481dc82376e22879e76a81fd2abb7138f5 /plugins/BossKeyPlus | |
parent | 3c4beeb99d4324fb453e928421c9b13d70ab4923 (diff) |
BossKey, BuddyExpectator, BuddyPounce, ChangeKeyboardLayout, ClientChangeNotify, Cln_skinedit, CmdLine: cmplugin adaptation
Diffstat (limited to 'plugins/BossKeyPlus')
-rw-r--r-- | plugins/BossKeyPlus/src/BossKey.cpp | 18 | ||||
-rw-r--r-- | plugins/BossKeyPlus/src/Options.cpp | 2 | ||||
-rw-r--r-- | plugins/BossKeyPlus/src/stdafx.h | 11 |
3 files changed, 15 insertions, 16 deletions
diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp index cbfca55369..dcf4da6bd6 100644 --- a/plugins/BossKeyPlus/src/BossKey.cpp +++ b/plugins/BossKeyPlus/src/BossKey.cpp @@ -19,7 +19,6 @@ #include "stdafx.h"
-HINSTANCE g_hInstance;
CLIST_INTERFACE *pcli;
HGENMENU g_hMenuItem;
HWINEVENTHOOK g_hWinHook;
@@ -31,6 +30,7 @@ WORD g_wMask, g_wMaskAdv; bool g_bWindowHidden, g_fPassRequested, g_TrayIcon;
char g_password[MAXPASSLEN + 1];
HKL oldLangID, oldLayout;
+CMPlugin g_plugin;
int protoCount, hLangpack;
PROTOACCOUNT **proto;
unsigned *oldStatus;
@@ -54,12 +54,6 @@ static PLUGININFOEX pluginInfo = { { 0x4fac353d, 0x0a36, 0x44a4, { 0x90, 0x64, 0x67, 0x59, 0xc5, 0x3a, 0xe7, 0x82 } }
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- g_hInstance = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
@@ -80,7 +74,7 @@ INT_PTR CALLBACK DlgStdInProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam switch (uMsg){
case WM_INITDIALOG:
g_hDlgPass = hDlg;
- hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_DLGPASSWD));
+ hIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_DLGPASSWD));
dwOldIcon = SetClassLongPtr(hDlg, GCLP_HICON, (INT_PTR)hIcon); // set alt+tab icon
SendDlgItemMessage(hDlg, IDC_EDIT1, EM_LIMITTEXT, MAXPASSLEN, 0);
@@ -378,7 +372,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara strncpy(g_password, dbVar.pszVal, MAXPASSLEN);
db_free(&dbVar);
- int res = DialogBox(g_hInstance, (MAKEINTRESOURCE(IDD_PASSDIALOGNEW)), GetForegroundWindow(), DlgStdInProc);
+ int res = DialogBox(g_plugin.getInst(), (MAKEINTRESOURCE(IDD_PASSDIALOGNEW)), GetForegroundWindow(), DlgStdInProc);
g_fPassRequested = false;
if (res != IDOK) return 0;
@@ -638,13 +632,13 @@ int MirandaLoaded(WPARAM, LPARAM) WNDCLASS winclass = { 0 };
winclass.lpfnWndProc = ListenWndProc;
- winclass.hInstance = g_hInstance;
+ winclass.hInstance = g_plugin.getInst();
winclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
winclass.lpszClassName = BOSSKEY_LISTEN_INFO;
if (RegisterClass(&winclass))
{
- g_hListenWindow = CreateWindow(BOSSKEY_LISTEN_INFO, BOSSKEY_LISTEN_INFO, WS_POPUP, 0, 0, 5, 5, pcli->hwndContactList, nullptr, g_hInstance, nullptr);
+ g_hListenWindow = CreateWindow(BOSSKEY_LISTEN_INFO, BOSSKEY_LISTEN_INFO, WS_POPUP, 0, 0, 5, 5, pcli->hwndContactList, nullptr, g_plugin.getInst(), nullptr);
WTSRegisterSessionNotification(g_hListenWindow, 0);
}
@@ -702,7 +696,7 @@ extern "C" int __declspec(dllexport) Load(void) db_set_b(NULL, "Popup", "ModuleIsEnabled", 0);
}
- Icon_Register(g_hInstance, "BossKey", iconList, _countof(iconList));
+ Icon_Register(g_plugin.getInst(), "BossKey", iconList, _countof(iconList));
CreateServiceFunction(MS_BOSSKEY_HIDE, BossKeyHideMiranda); // Create service
diff --git a/plugins/BossKeyPlus/src/Options.cpp b/plugins/BossKeyPlus/src/Options.cpp index bf973c734a..2779438530 100644 --- a/plugins/BossKeyPlus/src/Options.cpp +++ b/plugins/BossKeyPlus/src/Options.cpp @@ -318,7 +318,7 @@ int OptsDlgInit(WPARAM wParam, LPARAM) optDi.position = 920000000;
optDi.pfnDlgProc = MainOptDlg;
optDi.pszTemplate = MAKEINTRESOURCEA(IDD_OPTDIALOGMAIN);
- optDi.hInstance = g_hInstance;
+ optDi.hInstance = g_plugin.getInst();
optDi.szTitle.a = LPGEN("BossKey");
optDi.szGroup.a = LPGEN("Events");
optDi.szTab.a = LPGEN("Main");
diff --git a/plugins/BossKeyPlus/src/stdafx.h b/plugins/BossKeyPlus/src/stdafx.h index 77ec28d37c..5694e71e65 100644 --- a/plugins/BossKeyPlus/src/stdafx.h +++ b/plugins/BossKeyPlus/src/stdafx.h @@ -28,8 +28,6 @@ #include <shellapi.h>
#include <Wtsapi32.h>
-#define __NO_CMPLUGIN_NEEDED
-
#include <newpluginapi.h>
#include <m_utils.h>
#include <m_langpack.h>
@@ -50,6 +48,14 @@ #include "version.h"
#define MOD_NAME "BossKey"
+
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MOD_NAME)
+ {}
+};
+
#define KEY_DOWN(key) ((GetAsyncKeyState(key) & 0x8000) ? (true) : (false))
#define MAXPASSLEN 16
#define DEFAULTSETTING (OPT_SETONLINEBACK | OPT_DISABLESNDS | OPT_ONLINEONLY | OPT_USEDEFMSG)
@@ -81,7 +87,6 @@ const unsigned STATUS_ARR_TO_ID[8] = { ID_STATUS_OFFLINE, ID_STATUS_ONLINE, ID_STATUS_AWAY, ID_STATUS_NA, ID_STATUS_OCCUPIED, ID_STATUS_DND, ID_STATUS_FREECHAT, ID_STATUS_INVISIBLE };
extern bool g_fOptionsOpen; // options dialog is open. be sure not to hide anything while we're there.
extern WORD g_wMask, g_wMaskAdv;
-extern HINSTANCE g_hInstance;
extern bool g_bWindowHidden;
extern UINT minutes;
|