From e9b6fb67ea86cf2e817cc846988dc736b3a6e216 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 9 Jul 2018 18:48:45 +0300 Subject: unused variable g_hMainThread removed --- .../ClientChangeNotify/src/ClientChangeNotify.cpp | 24 ++++++++-------------- plugins/ClientChangeNotify/src/stdafx.h | 1 - 2 files changed, 8 insertions(+), 17 deletions(-) (limited to 'plugins/ClientChangeNotify') diff --git a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp index 1e80c5b4d1..99b8dfc2c1 100644 --- a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp +++ b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp @@ -19,8 +19,7 @@ #include "stdafx.h" -HANDLE g_hMainThread; -HGENMENU g_hTogglePopupsMenuItem; +HGENMENU g_hTogglePopupsMenuItem; CMPlugin g_plugin; @@ -60,16 +59,17 @@ static int CALLBACK MenuWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar return DefWindowProc(hWnd, uMsg, wParam, lParam); } -static VOID NTAPI ShowContactMenu(ULONG_PTR wParam) -// wParam = hContact +static VOID CALLBACK ShowContactMenu(void *param) { + MCONTACT hContact = (ULONG_PTR)param; + POINT pt; HWND hMenuWnd = CreateWindowEx(WS_EX_TOOLWINDOW, L"static", _A2W(MODULENAME) L"_MenuWindow", 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, nullptr, g_plugin.getInst(), nullptr); SetWindowLongPtr(hMenuWnd, GWLP_WNDPROC, (LONG_PTR)MenuWndProc); - HMENU hMenu = Menu_BuildContactMenu(wParam); + HMENU hMenu = Menu_BuildContactMenu(hContact); GetCursorPos(&pt); SetForegroundWindow(hMenuWnd); - Clist_MenuProcessCommand(TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hMenuWnd, nullptr), MPCF_CONTACTMENU, wParam); + Clist_MenuProcessCommand(TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hMenuWnd, nullptr), MPCF_CONTACTMENU, hContact); PostMessage(hMenuWnd, WM_NULL, 0, 0); DestroyMenu(hMenu); DestroyWindow(hMenuWnd); @@ -86,7 +86,7 @@ void Popup_DoAction(HWND hWnd, BYTE Action, PLUGIN_DATA*) case PCA_OPENMENU: // open contact menu if (hContact && hContact != INVALID_CONTACT_ID) - QueueUserAPC(ShowContactMenu, g_hMainThread, (ULONG_PTR)hContact); + CallFunctionAsync(ShowContactMenu, (void*)hContact); break; case PCA_OPENDETAILS: // open contact details window @@ -347,7 +347,7 @@ static int MirandaLoaded(WPARAM, LPARAM) int CMPlugin::Load() { HookEvent(ME_SYSTEM_MODULESLOADED, MirandaLoaded); - DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &g_hMainThread, THREAD_SET_CONTEXT, false, 0); + InitOptions(); if (db_get_b(NULL, MODULENAME, DB_SETTINGSVER, 0) < 1) { @@ -360,11 +360,3 @@ int CMPlugin::Load() } return 0; } - -///////////////////////////////////////////////////////////////////////////////////////// - -int CMPlugin::Unload() -{ - CloseHandle(g_hMainThread); - return 0; -} diff --git a/plugins/ClientChangeNotify/src/stdafx.h b/plugins/ClientChangeNotify/src/stdafx.h index c4ce64be06..7a95b54140 100644 --- a/plugins/ClientChangeNotify/src/stdafx.h +++ b/plugins/ClientChangeNotify/src/stdafx.h @@ -57,7 +57,6 @@ struct CMPlugin : public PLUGIN CMPlugin(); int Load() override; - int Unload() override; }; #include "TMyArray.h" -- cgit v1.2.3