From b12321b9897b511e94301b73c1c48c533412d739 Mon Sep 17 00:00:00 2001 From: Mataes Date: Wed, 16 May 2018 19:12:38 +0300 Subject: BossKey, BuddyExpectator, BuddyPounce, ChangeKeyboardLayout, ClientChangeNotify, Cln_skinedit, CmdLine: cmplugin adaptation --- plugins/ChangeKeyboardLayout/src/hook_events.cpp | 4 ++-- plugins/ChangeKeyboardLayout/src/main.cpp | 18 ++++++------------ plugins/ChangeKeyboardLayout/src/stdafx.h | 11 +++++++---- 3 files changed, 15 insertions(+), 18 deletions(-) (limited to 'plugins/ChangeKeyboardLayout/src') diff --git a/plugins/ChangeKeyboardLayout/src/hook_events.cpp b/plugins/ChangeKeyboardLayout/src/hook_events.cpp index ab73812bd7..c7148fb985 100644 --- a/plugins/ChangeKeyboardLayout/src/hook_events.cpp +++ b/plugins/ChangeKeyboardLayout/src/hook_events.cpp @@ -123,7 +123,7 @@ int ModulesLoaded(WPARAM, LPARAM) // Зарегим звук Skin_AddSound(SND_ChangeLayout, ModuleNameW, LPGENW("Changing Layout")); - Skin_AddSound(SND_ChangeCase, ModuleNameW, LPGENW("Changing Case")); + Skin_AddSound(SND_ChangeCase, ModuleNameW, LPGENW("Changing Case")); // Хук на нажатие клавиши kbHook_All = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)Keyboard_Hook, nullptr, GetCurrentThreadId()); @@ -141,7 +141,7 @@ int ModulesLoaded(WPARAM, LPARAM) int OnOptionsInitialise(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; - odp.hInstance = hInst; + odp.hInstance = g_plugin.getInst(); odp.pszTemplate = MAKEINTRESOURCEA(IDD_MAIN_OPTION_FORM); odp.szTitle.a = ModuleName; odp.szGroup.a = LPGEN("Message sessions"); diff --git a/plugins/ChangeKeyboardLayout/src/main.cpp b/plugins/ChangeKeyboardLayout/src/main.cpp index 5286a2f871..9d53aed4b1 100644 --- a/plugins/ChangeKeyboardLayout/src/main.cpp +++ b/plugins/ChangeKeyboardLayout/src/main.cpp @@ -1,12 +1,12 @@ #include "stdafx.h" +CMPlugin g_plugin; int hLangpack; LPTSTR ptszLayStrings[20]; HANDLE hChangeLayout, hGetLayoutOfText, hChangeTextLayout; HICON hPopupIcon, hCopyIcon; HKL hklLayouts[20]; BYTE bLayNum; -HINSTANCE hInst; HHOOK kbHook_All; MainOptions moOptions; PopupOptions poOptions, poOptionsTemp; @@ -31,12 +31,6 @@ LPCTSTR ptszSeparators = L" \t\n\r"; HANDLE hOptionsInitialize; -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) -{ - hInst = hinstDLL; - return TRUE; -} - extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) { return &pluginInfoEx; @@ -49,18 +43,18 @@ static IconItem iconList[] = }; extern "C" __declspec(dllexport) int Load(void) -{ +{ mir_getLP(&pluginInfoEx); memset(hklLayouts, 0, sizeof(hklLayouts)); bLayNum = GetKeyboardLayoutList(20, hklLayouts); - if (bLayNum < 2) + if (bLayNum < 2) return 1; - + HookEvent(ME_OPT_INITIALISE, OnOptionsInitialise); HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); // IcoLib support - Icon_Register(hInst, ModuleName, iconList, _countof(iconList)); + Icon_Register(g_plugin.getInst(), ModuleName, iconList, _countof(iconList)); HookEvent(ME_SKIN2_ICONSCHANGED, OnIconsChanged); @@ -71,7 +65,7 @@ extern "C" __declspec(dllexport) int Load(void) extern "C" __declspec(dllexport) int Unload(void) { - for (int i = 0; i < bLayNum; i++) + for (int i = 0; i < bLayNum; i++) mir_free(ptszLayStrings[i]); DestroyServiceFunction(hChangeLayout); diff --git a/plugins/ChangeKeyboardLayout/src/stdafx.h b/plugins/ChangeKeyboardLayout/src/stdafx.h index 7be6d07a35..fc572a11c8 100644 --- a/plugins/ChangeKeyboardLayout/src/stdafx.h +++ b/plugins/ChangeKeyboardLayout/src/stdafx.h @@ -5,8 +5,6 @@ #include #include -#define __NO_CMPLUGIN_NEEDED - #include #include #include @@ -31,6 +29,13 @@ #define ModuleName LPGEN("ChangeKeyboardLayout") #define ModuleNameW LPGENW("ChangeKeyboardLayout") +struct CMPlugin : public PLUGIN +{ + CMPlugin() : + PLUGIN(ModuleName) + {} +}; + // History++ API #define MS_HPP_EG_WINDOW "History++/ExtGrid/NewWindow" #define MS_HPP_EG_EVENT "History++/ExtGrid/Event" @@ -90,8 +95,6 @@ typedef struct POPUPACTION paActions[1]; } PopupOptions; -extern HINSTANCE hInst; - extern HICON hPopupIcon, hCopyIcon; extern LPCTSTR ptszKeybEng; -- cgit v1.2.3