From 06bb38dfa357a731e16980d03ab100b84e5cb989 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 25 Jun 2015 21:53:56 +0000 Subject: MS_CLUI_GETHWND & MS_CLUI_GETHWNDTREE replaced with pcli->hwndContactList & pcli->hwndContactTree respectively git-svn-id: http://svn.miranda-ng.org/main/trunk@14386 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Alarms/src/alarms.cpp | 2 + plugins/Alarms/src/frame.cpp | 14 +- plugins/Alarms/src/options.cpp | 2 - plugins/Alarms/src/stdafx.h | 1 + plugins/AutoShutdown/src/frame.cpp | 4 +- plugins/AutoShutdown/src/main.cpp | 3 + plugins/AutoShutdown/src/shutdownsvc.cpp | 2 +- plugins/BASS_interface/src/Main.cpp | 4 +- plugins/BASS_interface/src/stdafx.h | 1 + plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp | 8 +- plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp | 14 +- plugins/CmdLine/src/CmdLine.cpp | 8 +- plugins/CmdLine/src/mimcmd_handlers.cpp | 9 +- plugins/CmdLine/src/stdafx.h | 1 + plugins/ExternalAPI/m_skin_eng.h | 5 +- plugins/FloatingContacts/src/main.cpp | 2 +- plugins/HTTPServer/src/Glob.h | 1 + plugins/HTTPServer/src/GuiElements.cpp | 3 +- plugins/HTTPServer/src/main.cpp | 296 +++++++++++---------- plugins/HistoryStats/src/settings.cpp | 2 +- plugins/MenuItemEx/src/main.cpp | 4 +- plugins/MenuItemEx/src/menuex.h | 1 + plugins/MyDetails/src/frame.cpp | 4 +- plugins/MyDetails/src/mydetails.cpp | 2 + plugins/Nudge/src/headers.h | 1 + plugins/Nudge/src/main.cpp | 4 +- plugins/Nudge/src/shake.cpp | 4 +- plugins/Ping/src/common.h | 1 + plugins/Ping/src/ping.cpp | 14 +- plugins/Ping/src/pingthread.cpp | 4 +- plugins/Ping/src/utils.cpp | 5 +- plugins/Popup/src/headers.h | 1 + plugins/Popup/src/main.cpp | 3 +- plugins/Popup/src/popup_thread.cpp | 2 +- plugins/QuickSearch/sr_frame.pas | 4 +- .../StatusPlugins/StartupStatus/startupstatus.cpp | 4 +- plugins/TabSRMM/src/globals.cpp | 2 +- plugins/TipperYM/src/message_pump.cpp | 4 +- plugins/TopToolBar/src/InternalButtons.cpp | 6 +- plugins/TopToolBar/src/common.h | 1 + plugins/TopToolBar/src/main.cpp | 2 + plugins/TopToolBar/src/toolbarwnd.cpp | 2 +- plugins/TrafficCounter/src/TrafficCounter.cpp | 6 +- plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp | 4 +- plugins/Utils.pas/mircontacts.pas | 6 +- plugins/Utils.pas/protocols.pas | 26 +- plugins/Weather/src/weather.cpp | 2 + plugins/Weather/src/weather_mwin.cpp | 2 +- plugins/YAPP/src/common.h | 1 + plugins/YAPP/src/popwin.cpp | 2 +- plugins/YAPP/src/yapp.cpp | 3 + plugins/ZeroSwitch/src/ZeroSwitch.cpp | 4 +- plugins/ZeroSwitch/src/stdafx.h | 1 + plugins/mRadio/rframeapi.pas | 4 +- 54 files changed, 273 insertions(+), 245 deletions(-) (limited to 'plugins') diff --git a/plugins/Alarms/src/alarms.cpp b/plugins/Alarms/src/alarms.cpp index 0465421ff2..9c28386d1d 100644 --- a/plugins/Alarms/src/alarms.cpp +++ b/plugins/Alarms/src/alarms.cpp @@ -19,6 +19,7 @@ There is no warranty. TCHAR szGamePrefix[] = COMMANDPREFIX; +CLIST_INTERFACE *pcli; HINSTANCE hInst; int hLangpack; @@ -151,6 +152,7 @@ static int MainDeInit(WPARAM, LPARAM) extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfo); + mir_getCLI(); // ensure datetime picker is loaded INITCOMMONCONTROLSEX ccx; diff --git a/plugins/Alarms/src/frame.cpp b/plugins/Alarms/src/frame.cpp index c82ce4e96c..f29af0713d 100644 --- a/plugins/Alarms/src/frame.cpp +++ b/plugins/Alarms/src/frame.cpp @@ -264,7 +264,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar } else if (!IsWindowVisible(hwnd) && count > 0) { // we have reminders - show if not linked to clist or if clist is visible - if ((!options.hide_with_clist && FrameIsFloating()) || IsWindowVisible((HWND)CallService(MS_CLUI_GETHWND, 0, 0))) { + if ((!options.hide_with_clist && FrameIsFloating()) || IsWindowVisible(pcli->hwndContactList)) { CallService(MS_CLIST_FRAMES_SHFRAME, (WPARAM)frame_id, 0); CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)frame_id, FU_FMREDRAW | FU_FMPOS); } @@ -275,7 +275,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar SetReminderFrameVisible(false); else if (!IsWindowVisible(hwnd) && count > 0) // we have reminders - show if not linked to clist or if clist is visible - if (!options.hide_with_clist || IsWindowVisible((HWND)CallService(MS_CLUI_GETHWND, 0, 0))) + if (!options.hide_with_clist || IsWindowVisible(pcli->hwndContactList)) SetReminderFrameVisible(true); } } @@ -320,14 +320,14 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar SendMessage(hwnd, WMU_FILL_LIST, 0, 0); else if (wParam == ID_FRAME_SHOWHIDE_TIMER && options.hide_with_clist) { // link show/hide with clist // hide if we're visible and clist isn't (possible only when floating if frames are present) - if (!IsWindowVisible((HWND)CallService(MS_CLUI_GETHWND, 0, 0)) && IsWindowVisible(hwnd)) { + if (!IsWindowVisible(pcli->hwndContactList) && IsWindowVisible(hwnd)) { if (ServiceExists(MS_CLIST_FRAMES_SHFRAME)) CallService(MS_CLIST_FRAMES_SHFRAME, (WPARAM)frame_id, 0); else SetReminderFrameVisible(false); } // we're not visible but clist is - show depending on hide_with_clist and auto_showhide options - if (!IsWindowVisible(hwnd) && IsWindowVisible((HWND)CallService(MS_CLUI_GETHWND, 0, 0))) { + if (!IsWindowVisible(hwnd) && IsWindowVisible(pcli->hwndContactList)) { // if not auto show/hide, show (reminders or not) if we're not visible and the clist is // otherwise, show only if there are reminders int count = SendMessage(hwnd_list, LB_GETCOUNT, 0, 0); @@ -502,7 +502,7 @@ int CreateFrame() if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) { hwnd_plugin = CreateWindow(_T("AlarmsFrame"), TranslateT("Alarms"), WS_CHILD | WS_CLIPCHILDREN, - 0,0,10,10, (HWND)CallService(MS_CLUI_GETHWND, 0, 0), NULL,hInst,NULL); + 0,0,10,10, pcli->hwndContactList, NULL,hInst,NULL); CLISTFrame Frame = { sizeof(CLISTFrame) }; Frame.tname = TranslateT("Alarms"); @@ -528,7 +528,7 @@ int CreateFrame() hwnd_frame = CreateWindowEx(WS_EX_TOOLWINDOW, _T("AlarmsFrameContainer"), TranslateT("Alarms"), (WS_POPUPWINDOW | WS_THICKFRAME | WS_CAPTION | WS_SYSMENU | WS_CLIPCHILDREN) & ~WS_VISIBLE, - 0,0,200,100, (HWND)CallService(MS_CLUI_GETHWND, 0, 0), NULL,hInst,NULL); + 0,0,200,100, pcli->hwndContactList, NULL,hInst,NULL); //0,0,200,100, GetDesktopWindow(), NULL,hInst,NULL); hwnd_plugin = CreateWindow(_T("AlarmsFrame"), TranslateT("Alarms"), @@ -552,7 +552,7 @@ int CreateFrame() if (!options.auto_showhide) { if (options.hide_with_clist) { - if (IsWindowVisible((HWND)CallService(MS_CLUI_GETHWND, 0, 0))) { + if (IsWindowVisible(pcli->hwndContactList)) { ShowWindow(hwnd_frame, SW_SHOW); RefreshReminderFrame(); } diff --git a/plugins/Alarms/src/options.cpp b/plugins/Alarms/src/options.cpp index b4fbbc4f18..1f7ac9418c 100644 --- a/plugins/Alarms/src/options.cpp +++ b/plugins/Alarms/src/options.cpp @@ -1187,9 +1187,7 @@ INT_PTR NewAlarmMenuFunc(WPARAM, LPARAM) new_alarm->id = next_alarm_id++; GetPluginTime(&new_alarm->time); - //New((HWND)CallService(MS_CLUI_GETHWND, 0, 0), *new_alarm, false); New(GetDesktopWindow(), *new_alarm, false); - return 0; } diff --git a/plugins/Alarms/src/stdafx.h b/plugins/Alarms/src/stdafx.h index dc0eac1ba0..0bc8575e9d 100644 --- a/plugins/Alarms/src/stdafx.h +++ b/plugins/Alarms/src/stdafx.h @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include diff --git a/plugins/AutoShutdown/src/frame.cpp b/plugins/AutoShutdown/src/frame.cpp index e66b12998e..fb443ccadb 100644 --- a/plugins/AutoShutdown/src/frame.cpp +++ b/plugins/AutoShutdown/src/frame.cpp @@ -516,7 +516,7 @@ void ShowCountdownFrame(WORD fTimeFlags) 0, 0, GetSystemMetrics(SM_CXICON)+103, GetSystemMetrics(SM_CYICON)+2, - (HWND)CallService(MS_CLUI_GETHWND,0,0), + pcli->hwndContactList, NULL, hInst, &fTimeFlags); @@ -538,7 +538,7 @@ void ShowCountdownFrame(WORD fTimeFlags) /* HACKS TO FIX CLUI FRAMES: * *** why is CLUIFrames is horribly buggy??! *** date: sept 2005, nothing changed until sept 2006 * workaround #1: MS_CLIST_FRAMES_REMOVEFRAME does not finish with destroy cycle (clist_modern, clist_nicer crashes) */ - SendMessage((HWND)CallService(MS_CLUI_GETHWND,0,0),WM_SIZE,0,0); + SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0); /* workaround #2: drawing glitch after adding a frame (frame positioned wrongly when hidden) */ CallService(MS_CLIST_FRAMES_UPDATEFRAME,hFrame,FU_FMPOS|FU_FMREDRAW); /* workaround #3: MS_CLIST_FRAMES_SETFRAMEOPTIONS does cause redrawing problems */ diff --git a/plugins/AutoShutdown/src/main.cpp b/plugins/AutoShutdown/src/main.cpp index e7cdf5ac2d..480debca46 100644 --- a/plugins/AutoShutdown/src/main.cpp +++ b/plugins/AutoShutdown/src/main.cpp @@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" +CLIST_INTERFACE *pcli; HINSTANCE hInst; int hLangpack; @@ -68,6 +69,8 @@ extern "C" __declspec(dllexport) const PLUGININFOEX* MirandaPluginInfoEx(DWORD) extern "C" __declspec(dllexport) int Load(void) { mir_getLP(&pluginInfo); + mir_getCLI(); + INITCOMMONCONTROLSEX icc; icc.dwSize=sizeof(icc); icc.dwICC=ICC_DATE_CLASSES|ICC_UPDOWN_CLASS|ICC_PROGRESS_CLASS; diff --git a/plugins/AutoShutdown/src/shutdownsvc.cpp b/plugins/AutoShutdown/src/shutdownsvc.cpp index a19adbb2fa..778fcd79e2 100644 --- a/plugins/AutoShutdown/src/shutdownsvc.cpp +++ b/plugins/AutoShutdown/src/shutdownsvc.cpp @@ -146,7 +146,7 @@ static DWORD ShutdownNow(BYTE shutdownType) OutputDebugStringA("Not ready to exit. Waiting...\n"); /* tell others, all ascii */ } /* shutdown service must be called from main thread anyway */ - if (!DestroyWindow((HWND)CallService(MS_CLUI_GETHWND,0,0))) + if (!DestroyWindow(pcli->hwndContactList)) dwErrCode=GetLastError(); } break; diff --git a/plugins/BASS_interface/src/Main.cpp b/plugins/BASS_interface/src/Main.cpp index 5bc586b9a1..b9fac56ad3 100644 --- a/plugins/BASS_interface/src/Main.cpp +++ b/plugins/BASS_interface/src/Main.cpp @@ -27,6 +27,7 @@ extern "C" PfnDliHook __pfnDliNotifyHook2 = &delayHook; HINSTANCE hInst; int hLangpack; +CLIST_INTERFACE *pcli; PLUGININFOEX pluginInfo = { sizeof(PLUGININFOEX), @@ -461,7 +462,7 @@ void CreateFrame() RegisterClass(&wndclass); hwnd_plugin = CreateWindow(_T("BassInterfaceFrame"), TranslateT("Bass Interface"), - WS_CHILD | WS_CLIPCHILDREN, 0, 0, 10, 10, (HWND)CallService(MS_CLUI_GETHWND, 0, 0), NULL, hInst, NULL); + WS_CHILD | WS_CLIPCHILDREN, 0, 0, 10, 10, pcli->hwndContactList, NULL, hInst, NULL); CLISTFrame Frame = { sizeof(CLISTFrame) }; Frame.tname = TranslateT("Bass Interface"); @@ -609,6 +610,7 @@ static IconItem iconList[] = extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfo); + mir_getCLI(); HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown); diff --git a/plugins/BASS_interface/src/stdafx.h b/plugins/BASS_interface/src/stdafx.h index 09821041cd..e69ef0f03c 100644 --- a/plugins/BASS_interface/src/stdafx.h +++ b/plugins/BASS_interface/src/stdafx.h @@ -14,6 +14,7 @@ Copyright (C) 2010, 2011 tico-tico #include #include #include +#include #include #include #include diff --git a/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp b/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp index eedeba5e7d..ed9e5166ef 100644 --- a/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp +++ b/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp @@ -166,17 +166,17 @@ INT_PTR UseGroupsHelper(WPARAM, LPARAM) INT_PTR HideOfflineRootHelper(WPARAM, LPARAM) { SendMessage( - (HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0), + pcli->hwndContactTree, CLM_SETHIDEOFFLINEROOT, - !SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0), CLM_GETHIDEOFFLINEROOT, 0, 0), + !SendMessage(pcli->hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0), 0); return 0; } INT_PTR CreateGroupHelper(WPARAM, LPARAM) { - SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0), CLM_SETHIDEEMPTYGROUPS, 0, 0); - SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0), CLM_SETUSEGROUPS, 1, 0); + SendMessage(pcli->hwndContactTree, CLM_SETHIDEEMPTYGROUPS, 0, 0); + SendMessage(pcli->hwndContactTree, CLM_SETUSEGROUPS, 1, 0); Clist_CreateGroup(0, 0); return 0; }; diff --git a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp index d05cd7e509..34e8222803 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp @@ -162,24 +162,24 @@ INT_PTR FreeOwnerDataGroupMenu(WPARAM, LPARAM lParam) INT_PTR HideGroupsHelper(WPARAM, LPARAM) { - int newVal = !(GetWindowLongPtr((HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0), GWL_STYLE) & CLS_HIDEEMPTYGROUPS); + int newVal = !(GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS); cfg::writeByte("CList", "HideEmptyGroups", (BYTE)newVal); - SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0), CLM_SETHIDEEMPTYGROUPS, newVal, 0); + SendMessage(pcli->hwndContactTree, CLM_SETHIDEEMPTYGROUPS, newVal, 0); return 0; } INT_PTR UseGroupsHelper(WPARAM, LPARAM) { - int newVal = !(GetWindowLongPtr((HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0), GWL_STYLE) & CLS_USEGROUPS); + int newVal = !(GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_USEGROUPS); cfg::writeByte("CList", "UseGroups", (BYTE)newVal); - SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0), CLM_SETUSEGROUPS, newVal,0); + SendMessage(pcli->hwndContactTree, CLM_SETUSEGROUPS, newVal,0); return 0; } INT_PTR HideOfflineRootHelper(WPARAM, LPARAM) { - SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0), CLM_SETHIDEOFFLINEROOT, - !SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0), CLM_GETHIDEOFFLINEROOT, 0, 0), + SendMessage(pcli->hwndContactTree, CLM_SETHIDEOFFLINEROOT, + !SendMessage(pcli->hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0), 0); return 0; } @@ -454,7 +454,7 @@ INT_PTR FreeOwnerDataSubGroupMenu(WPARAM, LPARAM lParam) // wparam menu handle to pass to clc.c INT_PTR GroupMenuExecProxy(WPARAM wParam, LPARAM) { - SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0), WM_COMMAND, wParam, 0); + SendMessage(pcli->hwndContactTree, WM_COMMAND, wParam, 0); return 0; } diff --git a/plugins/CmdLine/src/CmdLine.cpp b/plugins/CmdLine/src/CmdLine.cpp index a8224f5b49..1b281cff61 100644 --- a/plugins/CmdLine/src/CmdLine.cpp +++ b/plugins/CmdLine/src/CmdLine.cpp @@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. char ModuleName[] = "CmdLine"; HINSTANCE hInstance; int hLangpack; +CLIST_INTERFACE *pcli; PLUGININFOEX pluginInfo = { sizeof(PLUGININFOEX), @@ -46,14 +47,12 @@ extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD) extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfo); + mir_getCLI(); if (InitServer()) - { MessageBox(0, TranslateT("Could not initialize CmdLine plugin property"), TranslateT("Error"), MB_ICONEXCLAMATION | MB_OK); - } HookEvents(); - return 0; } @@ -64,7 +63,6 @@ extern "C" int __declspec(dllexport) Unload() UnhookEvents(); DestroyServer(); - return 0; } @@ -72,4 +70,4 @@ bool WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) { hInstance = hinstDLL; return TRUE; -} \ No newline at end of file +} diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp index 7c18db81fd..75a6aee74c 100644 --- a/plugins/CmdLine/src/mimcmd_handlers.cpp +++ b/plugins/CmdLine/src/mimcmd_handlers.cpp @@ -550,8 +550,7 @@ void HandleClistCommand(PCommand command, TArgument *argv, int argc, PReply repl { case 2: { - HWND hClist = (HWND) CallService(MS_CLUI_GETHWND, 0, 0); - int state = IsWindowVisible(hClist); + int state = IsWindowVisible(pcli->hwndContactList); Set2StateReply(reply, state, 0, LPGEN("Contact list is currently shown."), "", LPGEN("Contact list is currently hidden."), ""); return; @@ -560,7 +559,7 @@ void HandleClistCommand(PCommand command, TArgument *argv, int argc, PReply repl case 3: { int state = 0; - HWND hClist = (HWND) CallService(MS_CLUI_GETHWND, 0, 0); + HWND hClist = pcli->hwndContactList; switch (Get2StateValue(argv[2])) { @@ -617,7 +616,7 @@ void HandleQuitCommand(PCommand command, TArgument *argv, int argc, PReply reply CallService("CloseAction", 0, 0); //try another quit method - HWND hWndMiranda = (HWND)CallService(MS_CLUI_GETHWND, 0, 0); + HWND hWndMiranda = pcli->hwndContactList; PostMessage(hWndMiranda, WM_COMMAND, ID_ICQ_EXIT, 0); reply->code = MIMRES_SUCCESS; @@ -636,7 +635,7 @@ void HandleQuitCommand(PCommand command, TArgument *argv, int argc, PReply reply CallService("CloseAction", 0, 0); //try another quit method - HWND hWndMiranda = (HWND)CallService(MS_CLUI_GETHWND, 0, 0); + HWND hWndMiranda = pcli->hwndContactList; PostMessage(hWndMiranda, WM_COMMAND, ID_ICQ_EXIT, 0); reply->code = MIMRES_SUCCESS; diff --git a/plugins/CmdLine/src/stdafx.h b/plugins/CmdLine/src/stdafx.h index 58df317ad2..2394d55fa8 100644 --- a/plugins/CmdLine/src/stdafx.h +++ b/plugins/CmdLine/src/stdafx.h @@ -29,6 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "newpluginapi.h" #include "m_database.h" #include "m_clist.h" +#include "m_clistint.h" #include "m_clui.h" #include "m_contacts.h" #include "m_langpack.h" diff --git a/plugins/ExternalAPI/m_skin_eng.h b/plugins/ExternalAPI/m_skin_eng.h index fa91f624e2..bb797fda9f 100644 --- a/plugins/ExternalAPI/m_skin_eng.h +++ b/plugins/ExternalAPI/m_skin_eng.h @@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define M_ske_H_INC #include +#include /*defaults*/ #define DEFAULT_FIT_MODE FM_STRETCH @@ -171,13 +172,11 @@ int __inline SkinDrawWindowBack(HWND hwndIn, HDC hdc, RECT * rcClip, char * obje POINT pt={0}; RECT rc,r1; - HWND hwnd=(HWND)CallService(MS_CLUI_GETHWND,0,0); if (!objectID) return 0; GetWindowRect(hwndIn,&r1); pt.x=r1.left; pt.y=r1.top; - //ClientToScreen(hwndIn,&pt); - GetWindowRect(hwnd,&rc); + GetWindowRect(pcli->hwndContactList, &rc); OffsetRect(&rc,-pt.x ,-pt.y); rq.hDC=hdc; rq.rcDestRect=rc; diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index 38aeeeee45..36047e19f3 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -871,7 +871,7 @@ static int OnModulesLoded(WPARAM, LPARAM) HookEvent(ME_CLIST_STATUSMODECHANGE, OnStatusModeChange); HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPrebuildContactMenu); - hwndMiranda = (HWND)CallService(MS_CLUI_GETHWND, 0, 0); + hwndMiranda = pcli->hwndContactList; mir_subclassWindow(hwndMiranda, newMirandaWndProc); // No thumbs yet diff --git a/plugins/HTTPServer/src/Glob.h b/plugins/HTTPServer/src/Glob.h index 2b5fe8e8c3..48d4c18479 100644 --- a/plugins/HTTPServer/src/Glob.h +++ b/plugins/HTTPServer/src/Glob.h @@ -31,6 +31,7 @@ using namespace std; #include #include #include +#include #include #include #include diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index 257a89b772..0e98449539 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -15,7 +15,6 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - #include "Glob.h" #define MS_SHARE_NEW_FILE "HTTPServer/ShareNewFile" @@ -1041,7 +1040,7 @@ static INT_PTR nShareNewFile(WPARAM hContact, LPARAM lParam) stNewShare.dwAllowedMask = 0; } - if (! bShowShareNewFileDlg((HWND)(lParam ? lParam : CallService(MS_CLUI_GETHWND, 0, 0)), &stNewShare)) + if (!bShowShareNewFileDlg((lParam ? HWND(lParam) : pcli->hwndContactList), &stNewShare)) return 0; if (stNewShare.dwAllowedIP) diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp index bdca6bfcf0..a885f8fe9f 100644 --- a/plugins/HTTPServer/src/main.cpp +++ b/plugins/HTTPServer/src/main.cpp @@ -49,6 +49,7 @@ HANDLE hNetlibUser; HANDLE hDirectBoundPort; HINSTANCE hInstance = NULL; +CLIST_INTERFACE *pcli; string sLogFilePath; @@ -223,7 +224,8 @@ DWORD dwReadIPAddress(char * pszStr, bool &bError) { // Developer : KN ///////////////////////////////////////////////////////////////////// -bool bReadConfigurationFile() { +bool bReadConfigurationFile() +{ CLFileShareListAccess clCritSection; CLFileShareNode * pclLastNode = NULL; @@ -326,7 +328,8 @@ bool bReadConfigurationFile() { // Developer : KN ///////////////////////////////////////////////////////////////////// -bool bWriteConfigurationFile() { +bool bWriteConfigurationFile() +{ CLFileShareListAccess clCritSection; char szBuf[1000]; mir_strcpy(szBuf, szPluginPath); @@ -389,7 +392,8 @@ bool bWriteConfigurationFile() { // Developer : KN, Houdini, changed By Sergio Vieira Rolanski ///////////////////////////////////////////////////////////////////// -static INT_PTR nAddChangeRemoveShare(WPARAM wParam, LPARAM lParam) { +static INT_PTR nAddChangeRemoveShare(WPARAM wParam, LPARAM lParam) +{ if (!lParam) return 1001; @@ -477,7 +481,8 @@ static INT_PTR nAddChangeRemoveShare(WPARAM wParam, LPARAM lParam) { // Developer : KN ///////////////////////////////////////////////////////////////////// -static INT_PTR nGetShare(WPARAM /*wParam*/, LPARAM lParam) { +static INT_PTR nGetShare(WPARAM /*wParam*/, LPARAM lParam) +{ if (!lParam) return 1001; @@ -516,7 +521,8 @@ static INT_PTR nGetShare(WPARAM /*wParam*/, LPARAM lParam) { // Developer : KN ///////////////////////////////////////////////////////////////////// -static INT_PTR nHttpGetAllShares(WPARAM /*wParam*/, LPARAM /*lParam*/) {/* +static INT_PTR nHttpGetAllShares(WPARAM /*wParam*/, LPARAM /*lParam*/) +{/* STFileShareInfo ** pTarget = (STFileShareInfo**)lParam; CLFileShareNode * pclCur; @@ -539,7 +545,6 @@ static INT_PTR nHttpGetAllShares(WPARAM /*wParam*/, LPARAM /*lParam*/) {/* return 0; } - ///////////////////////////////////////////////////////////////////// // Member Function : HandleNewConnection // Type : Global @@ -553,7 +558,8 @@ static INT_PTR nHttpGetAllShares(WPARAM /*wParam*/, LPARAM /*lParam*/) {/* // Developer : KN ///////////////////////////////////////////////////////////////////// -void HandleNewConnection(void *ch) { +void HandleNewConnection(void *ch) +{ CLHttpUser * pclUser = (CLHttpUser *)ch; pclUser->HandleNewConnection(); delete pclUser; @@ -573,7 +579,8 @@ void HandleNewConnection(void *ch) { // Developer : KN ///////////////////////////////////////////////////////////////////// -void ConnectionOpen(HANDLE hNewConnection, DWORD dwRemoteIP) { +void ConnectionOpen(HANDLE hNewConnection, DWORD dwRemoteIP) +{ in_addr stAddr; stAddr.S_un.S_addr = htonl(dwRemoteIP); @@ -596,7 +603,8 @@ void ConnectionOpen(HANDLE hNewConnection, DWORD dwRemoteIP) { // Developer : KN ///////////////////////////////////////////////////////////////////// -static int nProtoAck(WPARAM /*wParam*/, LPARAM lParam) { +static int nProtoAck(WPARAM /*wParam*/, LPARAM lParam) +{ //todo: ignore weather protos ACKDATA *ack = (ACKDATA *)lParam; if (ack->type != ACKTYPE_STATUS || //only send for statuses @@ -607,7 +615,6 @@ static int nProtoAck(WPARAM /*wParam*/, LPARAM lParam) { return 0; } - ///////////////////////////////////////////////////////////////////// // Member Function : nToggelAcceptConnections // Type : Global @@ -679,7 +686,8 @@ INT_PTR nToggelAcceptConnections(WPARAM wparam, LPARAM /*lparam*/) // Developer : KN ///////////////////////////////////////////////////////////////////// -BOOL WINAPI DllMain(HINSTANCE hinst, DWORD /*fdwReason*/, LPVOID /*lpvReserved*/) { +BOOL WINAPI DllMain(HINSTANCE hinst, DWORD /*fdwReason*/, LPVOID /*lpvReserved*/) +{ hInstance = hinst; return 1; } @@ -698,15 +706,9 @@ BOOL WINAPI DllMain(HINSTANCE hinst, DWORD /*fdwReason*/, LPVOID /*lpvReserved*/ // Developer : KN ///////////////////////////////////////////////////////////////////// -int MainInit(WPARAM /*wparam*/, LPARAM /*lparam*/) { - /* - STFileShareInfo * pShares = (STFileShareInfo *)5; - CallService(MS_HTTP_GET_ALL_SHARES, 0, (LPARAM) &pShares); - MirandaFree( pShares );*/ - - if (! bReadConfigurationFile()) { - //MessageBox( NULL, "Failed to read configuration file : " szConfigFile, MSG_BOX_TITEL, MB_OK ); - +int MainInit(WPARAM /*wparam*/, LPARAM /*lparam*/) +{ + if (!bReadConfigurationFile()) { char szRealPath[MAX_PATH]; char szSrvPath[MAX_PATH] = {0}; STFileShareInfo share; @@ -736,7 +738,6 @@ int MainInit(WPARAM /*wparam*/, LPARAM /*lparam*/) { bWriteConfigurationFile(); } - NETLIBUSER nlu = { 0 }; nlu.cbSize = sizeof(nlu); nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_TCHAR; @@ -770,7 +771,8 @@ int MainInit(WPARAM /*wparam*/, LPARAM /*lparam*/) { // Developer : KN ///////////////////////////////////////////////////////////////////// -int PreShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/) { +int PreShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/) +{ { CLFileShareListAccess clCrit; bShutdownInProgress = true; @@ -802,7 +804,8 @@ int PreShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/) { // Developer : KN ///////////////////////////////////////////////////////////////////// -int nSystemShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/) { +int nSystemShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/) +{ while (pclFirstNode) { CLFileShareNode * pclCur = pclFirstNode; pclFirstNode = pclFirstNode->pclNext; @@ -818,142 +821,143 @@ int nSystemShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/) { return 0; } - ///////////////////////////////////////////////////////////////////// - // Member Function : MirandaPluginInfoEx - // Type : Global - // Parameters : mirandaVersion - ? - // Returns : - // Description : - // - // References : - - // Remarks : - - // Created : 020422, 22 April 2002 - // Developer : KN, Houdini - ///////////////////////////////////////////////////////////////////// - - extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD /*mirandaVersion*/) { - return &pluginInfo; - } +///////////////////////////////////////////////////////////////////// +// Member Function : MirandaPluginInfoEx +// Type : Global +// Parameters : mirandaVersion - ? +// Returns : +// Description : +// +// References : - +// Remarks : - +// Created : 020422, 22 April 2002 +// Developer : KN, Houdini +///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - // Member Function : Load - // Type : Global - // Parameters : link - ? - // Returns : int - // Description : - // - // References : - - // Remarks : - - // Created : 020422, 22 April 2002 - // Developer : KN - ///////////////////////////////////////////////////////////////////// - - extern "C" __declspec(dllexport) int Load() { - mir_getLP(&pluginInfo); - - hHttpAcceptConnectionsService = CreateServiceFunction(MS_HTTP_ACCEPT_CONNECTIONS, nToggelAcceptConnections); - if (! hHttpAcceptConnectionsService) { - MessageBox(NULL, _T("Failed to CreateServiceFunction MS_HTTP_ACCEPT_CONNECTIONS"), MSG_BOX_TITEL, MB_OK); - return 1; - } +extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD /*mirandaVersion*/) { + return &pluginInfo; +} - hHttpAddChangeRemoveService = CreateServiceFunction(MS_HTTP_ADD_CHANGE_REMOVE, nAddChangeRemoveShare); - if (! hHttpAddChangeRemoveService) { - MessageBox(NULL, _T("Failed to CreateServiceFunction MS_HTTP_ADD_CHANGE_REMOVE"), MSG_BOX_TITEL, MB_OK); - return 1; - } +///////////////////////////////////////////////////////////////////// +// Member Function : Load +// Type : Global +// Parameters : link - ? +// Returns : int +// Description : +// +// References : - +// Remarks : - +// Created : 020422, 22 April 2002 +// Developer : KN +///////////////////////////////////////////////////////////////////// - hHttpGetShareService = CreateServiceFunction(MS_HTTP_GET_SHARE, nGetShare); - if (! hHttpGetShareService) { - MessageBox(NULL, _T("Failed to CreateServiceFunction MS_HTTP_GET_SHARE"), MSG_BOX_TITEL, MB_OK); - return 1; - } +extern "C" __declspec(dllexport) int Load() +{ + mir_getLP(&pluginInfo); + mir_getCLI(); - hHttpGetAllShares = CreateServiceFunction(MS_HTTP_GET_ALL_SHARES, nHttpGetAllShares); - if (! hHttpGetAllShares) { - MessageBox(NULL, _T("Failed to CreateServiceFunction MS_HTTP_GET_ALL_SHARES"), MSG_BOX_TITEL, MB_OK); - return 1; - } + hHttpAcceptConnectionsService = CreateServiceFunction(MS_HTTP_ACCEPT_CONNECTIONS, nToggelAcceptConnections); + if (! hHttpAcceptConnectionsService) { + MessageBox(NULL, _T("Failed to CreateServiceFunction MS_HTTP_ACCEPT_CONNECTIONS"), MSG_BOX_TITEL, MB_OK); + return 1; + } + hHttpAddChangeRemoveService = CreateServiceFunction(MS_HTTP_ADD_CHANGE_REMOVE, nAddChangeRemoveShare); + if (! hHttpAddChangeRemoveService) { + MessageBox(NULL, _T("Failed to CreateServiceFunction MS_HTTP_ADD_CHANGE_REMOVE"), MSG_BOX_TITEL, MB_OK); + return 1; + } - hEventSystemInit = HookEvent(ME_SYSTEM_MODULESLOADED, MainInit); - if (!hEventSystemInit) { - MessageBox(NULL, _T("Failed to HookEvent ME_SYSTEM_MODULESLOADED"), MSG_BOX_TITEL, MB_OK); - return 1; - } + hHttpGetShareService = CreateServiceFunction(MS_HTTP_GET_SHARE, nGetShare); + if (! hHttpGetShareService) { + MessageBox(NULL, _T("Failed to CreateServiceFunction MS_HTTP_GET_SHARE"), MSG_BOX_TITEL, MB_OK); + return 1; + } - hPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown); - if (!hPreShutdown) { - MessageBox(NULL, _T("Failed to HookEvent ME_SYSTEM_PRESHUTDOWN"), MSG_BOX_TITEL, MB_OK); - return 1; - } + hHttpGetAllShares = CreateServiceFunction(MS_HTTP_GET_ALL_SHARES, nHttpGetAllShares); + if (! hHttpGetAllShares) { + MessageBox(NULL, _T("Failed to CreateServiceFunction MS_HTTP_GET_ALL_SHARES"), MSG_BOX_TITEL, MB_OK); + return 1; + } - if(CallService(MS_DB_GETPROFILEPATH,MAX_PATH,(LPARAM)szPluginPath)) - { - MessageBox(NULL, _T("Failed to retrieve plugin path."), MSG_BOX_TITEL, MB_OK); - return 1; - } - mir_tstrncat(szPluginPath, _T("\\HTTPServer\\"), _countof(szPluginPath) - mir_tstrlen(szPluginPath)); - int err = CreateDirectoryTree(szPluginPath); - if((err != 0) && (err != ERROR_ALREADY_EXISTS)) - { - MessageBox(NULL, _T("Failed to create HTTPServer directory."), MSG_BOX_TITEL, MB_OK); - return 1; - } - nPluginPathLen = (int)mir_strlen(szPluginPath); + hEventSystemInit = HookEvent(ME_SYSTEM_MODULESLOADED, MainInit); + if (!hEventSystemInit) { + MessageBox(NULL, _T("Failed to HookEvent ME_SYSTEM_MODULESLOADED"), MSG_BOX_TITEL, MB_OK); + return 1; + } - sLogFilePath = szPluginPath; - sLogFilePath += "HTTPServer.log"; + hPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown); + if (!hPreShutdown) { + MessageBox(NULL, _T("Failed to HookEvent ME_SYSTEM_PRESHUTDOWN"), MSG_BOX_TITEL, MB_OK); + return 1; + } - if (! bInitMimeHandling()) { - MessageBox(NULL, "Failed to read configuration file : " szMimeTypeConfigFile, MSG_BOX_TITEL, MB_OK); - } + if(CallService(MS_DB_GETPROFILEPATH,MAX_PATH,(LPARAM)szPluginPath)) + { + MessageBox(NULL, _T("Failed to retrieve plugin path."), MSG_BOX_TITEL, MB_OK); + return 1; + } + mir_tstrncat(szPluginPath, _T("\\HTTPServer\\"), _countof(szPluginPath) - mir_tstrlen(szPluginPath)); + int err = CreateDirectoryTree(szPluginPath); + if((err != 0) && (err != ERROR_ALREADY_EXISTS)) + { + MessageBox(NULL, _T("Failed to create HTTPServer directory."), MSG_BOX_TITEL, MB_OK); + return 1; + } + + nPluginPathLen = (int)mir_strlen(szPluginPath); + + sLogFilePath = szPluginPath; + sLogFilePath += "HTTPServer.log"; + + if (!bInitMimeHandling()) + MessageBox(NULL, "Failed to read configuration file : " szMimeTypeConfigFile, MSG_BOX_TITEL, MB_OK); + + nMaxUploadSpeed = db_get_dw(NULL, MODULE, "MaxUploadSpeed", nMaxUploadSpeed); + nMaxConnectionsTotal = db_get_dw(NULL, MODULE, "MaxConnectionsTotal", nMaxConnectionsTotal); + nMaxConnectionsPerUser = db_get_dw(NULL, MODULE, "MaxConnectionsPerUser", nMaxConnectionsPerUser); + bLimitOnlyWhenOnline = db_get_b(NULL, MODULE, "LimitOnlyWhenOnline", bLimitOnlyWhenOnline) != 0; + indexCreationMode = (eIndexCreationMode) db_get_b(NULL, MODULE, "IndexCreationMode", 2); + + if (db_get_b(NULL, MODULE, "AddAcceptConMenuItem", 1)) { + CLISTMENUITEM mi = { 0 }; + mi.flags = CMIF_TCHAR; + mi.pszContactOwner = NULL; //all contacts + mi.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SHARE_NEW_FILE)); + mi.position = 1000085000; + mi.pszName = LPGENT("Enable HTTP server"); + mi.pszService = MS_HTTP_ACCEPT_CONNECTIONS; + hAcceptConnectionsMenuItem = Menu_AddMainMenuItem(&mi); + } - nMaxUploadSpeed = db_get_dw(NULL, MODULE, "MaxUploadSpeed", nMaxUploadSpeed); - nMaxConnectionsTotal = db_get_dw(NULL, MODULE, "MaxConnectionsTotal", nMaxConnectionsTotal); - nMaxConnectionsPerUser = db_get_dw(NULL, MODULE, "MaxConnectionsPerUser", nMaxConnectionsPerUser); - bLimitOnlyWhenOnline = db_get_b(NULL, MODULE, "LimitOnlyWhenOnline", bLimitOnlyWhenOnline) != 0; - indexCreationMode = (eIndexCreationMode) db_get_b(NULL, MODULE, "IndexCreationMode", 2); - - if (db_get_b(NULL, MODULE, "AddAcceptConMenuItem", 1)) { - CLISTMENUITEM mi = { 0 }; - mi.flags = CMIF_TCHAR; - mi.pszContactOwner = NULL; //all contacts - mi.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SHARE_NEW_FILE)); - mi.position = 1000085000; - mi.pszName = LPGENT("Enable HTTP server"); - mi.pszService = MS_HTTP_ACCEPT_CONNECTIONS; - hAcceptConnectionsMenuItem = Menu_AddMainMenuItem(&mi); + if (indexCreationMode == INDEX_CREATION_HTML || indexCreationMode == INDEX_CREATION_DETECT) + if (!LoadIndexHTMLTemplate()) { + indexCreationMode = INDEX_CREATION_DISABLE; + db_set_b(NULL, MODULE, "IndexCreationMode", (BYTE)indexCreationMode); } - if (indexCreationMode == INDEX_CREATION_HTML || - indexCreationMode == INDEX_CREATION_DETECT) - if (!LoadIndexHTMLTemplate()) { - indexCreationMode = INDEX_CREATION_DISABLE; - db_set_b(NULL, MODULE, "IndexCreationMode", (BYTE)indexCreationMode); - } + hEventProtoAck = HookEvent(ME_PROTO_ACK, nProtoAck); + return 0; +} - hEventProtoAck = HookEvent(ME_PROTO_ACK, nProtoAck); - return 0; - } +///////////////////////////////////////////////////////////////////// +// Member Function : Unload +// Type : Global +// Parameters : none +// Returns : +// Description : +// +// References : - +// Remarks : - +// Created : 020422, 22 April 2002 +// Developer : KN +///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - // Member Function : Unload - // Type : Global - // Parameters : none - // Returns : - // Description : - // - // References : - - // Remarks : - - // Created : 020422, 22 April 2002 - // Developer : KN - ///////////////////////////////////////////////////////////////////// - - extern "C" __declspec(dllexport) int Unload() { - nSystemShutdown(0, 0); - if(hwndStatsticView) - DestroyWindow(hwndStatsticView); - return 0; - } \ No newline at end of file +extern "C" __declspec(dllexport) int Unload() +{ + nSystemShutdown(0, 0); + if(hwndStatsticView) + DestroyWindow(hwndStatsticView); + return 0; +} diff --git a/plugins/HistoryStats/src/settings.cpp b/plugins/HistoryStats/src/settings.cpp index 730db1a4ee..3afbb3aaa5 100644 --- a/plugins/HistoryStats/src/settings.cpp +++ b/plugins/HistoryStats/src/settings.cpp @@ -21,7 +21,7 @@ Settings::CharMapper::CharMapper(const Settings& settings) } LCID lcid = GetUserDefaultLCID(); - LCMapString( + int len = LCMapString( lcid, LCMAP_LINGUISTIC_CASING | LCMAP_LOWERCASE, m_CharMap + 1, array_len(m_CharMap) - 1, m_CharMap + 1, array_len(m_CharMap) - 1); diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index 2631515ecb..6b5000c5a5 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -15,6 +15,7 @@ const int vf_default = VF_VS | VF_HFL | VF_IGN | VF_CID | VF_SHOWID | VF_RECV | VF_STAT | VF_SMNAME | VF_CIDN | VF_CIP; +CLIST_INTERFACE *pcli; HINSTANCE hinstance; HGENMENU hmenuVis, hmenuOff, hmenuHide, hmenuIgnore, hmenuProto, hmenuAdded, hmenuAuthReq; HGENMENU hmenuCopyID, hmenuRecvFiles, hmenuStatusMsg, hmenuCopyIP, hmenuCopyMirVer; @@ -429,7 +430,7 @@ INT_PTR onSendAuthRequest(WPARAM wparam, LPARAM) if (flags&PF4_NOCUSTOMAUTH) CallContactService(hContact, PSS_AUTHREQUEST, 0, (LPARAM)_T("")); else - CreateDialogParam(hinstance, MAKEINTRESOURCE(IDD_AUTHREQ), (HWND)CallService(MS_CLUI_GETHWND, 0, 0), AuthReqWndProc, (LPARAM)hContact); + CreateDialogParam(hinstance, MAKEINTRESOURCE(IDD_AUTHREQ), pcli->hwndContactList, AuthReqWndProc, (LPARAM)hContact); return 0; } @@ -1069,6 +1070,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) extern "C" __declspec(dllexport) int Load(void) { mir_getLP(&pluginInfoEx); + mir_getCLI(); Icon_Register(hinstance, LPGEN("MenuItemEx"), iconList, _countof(iconList)); Icon_Register(hinstance, LPGEN("MenuItemEx"), overlayIconList, _countof(overlayIconList)); diff --git a/plugins/MenuItemEx/src/menuex.h b/plugins/MenuItemEx/src/menuex.h index 1d3ae7cda6..72948e239a 100644 --- a/plugins/MenuItemEx/src/menuex.h +++ b/plugins/MenuItemEx/src/menuex.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include diff --git a/plugins/MyDetails/src/frame.cpp b/plugins/MyDetails/src/frame.cpp index c7a9b9480a..efeaad5c0f 100644 --- a/plugins/MyDetails/src/frame.cpp +++ b/plugins/MyDetails/src/frame.cpp @@ -272,7 +272,7 @@ int CreateFrame() if (g_bFramesExist) { hwnd_frame = CreateWindow(WINDOW_CLASS_NAME, TranslateT("My details"), WS_CHILD | WS_VISIBLE, - 0, 0, 10, 10, (HWND)CallService(MS_CLUI_GETHWND, 0, 0), NULL, hInst, NULL); + 0, 0, 10, 10, pcli->hwndContactList, NULL, hInst, NULL); CLISTFrame Frame = { 0 }; @@ -317,7 +317,7 @@ int CreateFrame() hwnd_container = CreateWindowEx(WS_EX_TOOLWINDOW, CONTAINER_CLASS_NAME, TranslateT("My details"), (WS_THICKFRAME | WS_CAPTION | WS_SYSMENU) & ~WS_VISIBLE, - 0, 0, 200, 130, (HWND)CallService(MS_CLUI_GETHWND, 0, 0), NULL, hInst, NULL); + 0, 0, 200, 130, pcli->hwndContactList, NULL, hInst, NULL); hwnd_frame = CreateWindow(WINDOW_CLASS_NAME, TranslateT("My details"), WS_CHILD | WS_VISIBLE, 0, 0, 10, 10, hwnd_container, NULL, hInst, NULL); diff --git a/plugins/MyDetails/src/mydetails.cpp b/plugins/MyDetails/src/mydetails.cpp index 0dea853ec2..88dc26a77c 100644 --- a/plugins/MyDetails/src/mydetails.cpp +++ b/plugins/MyDetails/src/mydetails.cpp @@ -19,6 +19,7 @@ Boston, MA 02111-1307, USA. #include "commons.h" +CLIST_INTERFACE *pcli; HINSTANCE hInst; int hLangpack = 0; @@ -139,6 +140,7 @@ static int MainUninit(WPARAM, LPARAM) extern "C" __declspec(dllexport) int Load() { mir_getLP(&pluginInfo); + mir_getCLI(); // Hook event to load messages and show first one HookEvent(ME_SYSTEM_MODULESLOADED, MainInit); diff --git a/plugins/Nudge/src/headers.h b/plugins/Nudge/src/headers.h index 5a1fa0e324..34c5abaf07 100644 --- a/plugins/Nudge/src/headers.h +++ b/plugins/Nudge/src/headers.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp index ac5e64c5f0..5ff5cf9a86 100644 --- a/plugins/Nudge/src/main.cpp +++ b/plugins/Nudge/src/main.cpp @@ -10,6 +10,7 @@ CNudgeElement DefaultNudge; CShake shake; CNudge GlobalNudge; +CLIST_INTERFACE *pcli; int hLangpack = 0; //======================== @@ -82,7 +83,7 @@ INT_PTR NudgeSend(WPARAM hContact, LPARAM lParam) void OpenContactList() { - HWND hWnd = (HWND) CallService(MS_CLUI_GETHWND,0,0); + HWND hWnd = pcli->hwndContactList; ShowWindow(hWnd, SW_RESTORE); ShowWindow(hWnd, SW_SHOW); } @@ -320,6 +321,7 @@ int AccListChanged(WPARAM wParam, LPARAM lParam) extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfo); + mir_getCLI(); LoadIcons(); diff --git a/plugins/Nudge/src/shake.cpp b/plugins/Nudge/src/shake.cpp index 8ebd3a97f1..cf3e7c24f2 100644 --- a/plugins/Nudge/src/shake.cpp +++ b/plugins/Nudge/src/shake.cpp @@ -31,9 +31,7 @@ void __cdecl ShakeClistWindow(void *Param) INT_PTR ShakeClist(WPARAM wParam, LPARAM lParam) { - HWND hWnd = (HWND)CallService(MS_CLUI_GETHWND, 0, 0); - - mir_forkthread(ShakeClistWindow, (void*)hWnd); + mir_forkthread(ShakeClistWindow, (void*)pcli->hwndContactList); return 0; } diff --git a/plugins/Ping/src/common.h b/plugins/Ping/src/common.h index 2bcf3b286a..b044c440d5 100644 --- a/plugins/Ping/src/common.h +++ b/plugins/Ping/src/common.h @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/plugins/Ping/src/ping.cpp b/plugins/Ping/src/ping.cpp index 3a4f5f26b6..261b959ada 100644 --- a/plugins/Ping/src/ping.cpp +++ b/plugins/Ping/src/ping.cpp @@ -1,5 +1,6 @@ #include "common.h" +CLIST_INTERFACE *pcli; HINSTANCE hInst; int hLangpack = 0; @@ -34,7 +35,8 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda return &pluginInfo; } -void CreatePluginServices() { +void CreatePluginServices() +{ // general CreateServiceFunction(PLUG "/Ping", PluginPing); CreateServiceFunction(PLUG "/DblClick", DblClick); @@ -79,7 +81,8 @@ int OnShutdown(WPARAM wParam, LPARAM lParam) { return 0; } -int OnModulesLoaded(WPARAM, LPARAM) { +int OnModulesLoaded(WPARAM, LPARAM) +{ NETLIBUSER nl_user = { 0 }; nl_user.cbSize = sizeof(nl_user); nl_user.szSettingsModule = PLUG; @@ -127,11 +130,10 @@ static IconItem iconList[] = extern "C" __declspec(dllexport) int Load(void) { - //if(init_raw_ping()) { - //MessageBox(0, Translate("Failed to initialize. Plugin disabled."), Translate("Ping Plugin"), MB_OK | MB_ICONERROR); - //return 1; + mir_getLP(&pluginInfo); + mir_getCLI(); + use_raw_ping = false; - //} db_set_b(0, PLUG, "UsingRawSockets", (BYTE)use_raw_ping); DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &mainThread, THREAD_SET_CONTEXT, FALSE, 0); diff --git a/plugins/Ping/src/pingthread.cpp b/plugins/Ping/src/pingthread.cpp index b44d165833..1534edbfee 100644 --- a/plugins/Ping/src/pingthread.cpp +++ b/plugins/Ping/src/pingthread.cpp @@ -228,7 +228,7 @@ void __cdecl sttCheckStatusThreadProc(void *vp) if (!get_list_changed()) { upCount = count; - total = index; + total = (int)index; } else total = 0; } @@ -952,7 +952,7 @@ void AttachToClist(bool attach) void InitList() { - hwnd_clist = (HWND)CallService(MS_CLUI_GETHWND, 0, 0); + hwnd_clist = pcli->hwndContactList; WNDCLASS wndclass; diff --git a/plugins/Ping/src/utils.cpp b/plugins/Ping/src/utils.cpp index 16adad8964..3040e69270 100644 --- a/plugins/Ping/src/utils.cpp +++ b/plugins/Ping/src/utils.cpp @@ -178,9 +178,10 @@ INT_PTR ToggleEnabled(WPARAM wParam, LPARAM lParam) { return 0; } -INT_PTR EditContact(WPARAM wParam, LPARAM lParam) { +INT_PTR EditContact(WPARAM wParam, LPARAM lParam) +{ PINGLIST pl; - HWND hwndList = (HWND)CallService(MS_CLUI_GETHWND, 0, 0); + HWND hwndList = pcli->hwndContactList; CallService(PLUG "/GetPingList", 0, (LPARAM)&pl); for (pinglist_it i = pl.begin(); i != pl.end(); ++i) { diff --git a/plugins/Popup/src/headers.h b/plugins/Popup/src/headers.h index 4db076f80a..811cefa0b2 100644 --- a/plugins/Popup/src/headers.h +++ b/plugins/Popup/src/headers.h @@ -64,6 +64,7 @@ http://miranda-ng.org/distr/ #include #include #include +#include #include #include #include diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index 8bd25c587d..2adce19774 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -37,6 +37,7 @@ void UpgradeDb(); static int OkToExit(WPARAM, LPARAM); bool OptionLoaded = false; int hLangpack = 0; +CLIST_INTERFACE *pcli; //===== Global variables ================================================================ HMODULE hUserDll = 0; @@ -325,6 +326,7 @@ MIRAPI int Load(void) DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &hMainThread, THREAD_SET_CONTEXT, FALSE, 0); mir_getLP(&pluginInfoEx); + mir_getCLI(); CreateServiceFunction(MS_POPUP_GETSTATUS, GetStatus); @@ -442,6 +444,5 @@ MIRAPI int Unload(void) UnloadTreeData(); CloseHandle(hMainThread); - return 0; } diff --git a/plugins/Popup/src/popup_thread.cpp b/plugins/Popup/src/popup_thread.cpp index 2bbda488f6..a586cf3eb5 100644 --- a/plugins/Popup/src/popup_thread.cpp +++ b/plugins/Popup/src/popup_thread.cpp @@ -68,7 +68,7 @@ bool UpdatePopupPosition(PopupWnd2 *prev, PopupWnd2 *wnd) else { // Multimonitor stuff (we have more then 1) HWND hWnd; if (PopupOptions.Monitor == MN_MIRANDA) - hWnd = (HWND)CallService(MS_CLUI_GETHWND, 0, 0); + hWnd = pcli->hwndContactList; else // PopupOptions.Monitor == MN_ACTIVE hWnd = GetForegroundWindow(); diff --git a/plugins/QuickSearch/sr_frame.pas b/plugins/QuickSearch/sr_frame.pas index 2ab6803c66..44cc51bb60 100644 --- a/plugins/QuickSearch/sr_frame.pas +++ b/plugins/QuickSearch/sr_frame.pas @@ -155,7 +155,7 @@ begin hbr:=0; if parent=0 then - parent:=CallService(MS_CLUI_GETHWND,0,0); + parent:=cli^.hwndContactList; if FrameWnd=0 then FrameWnd:=CreateDialog(hInstance,MAKEINTRESOURCE(IDD_FRAME),parent,@QSFrameProc); @@ -181,7 +181,7 @@ begin begin CallService(MS_CLIST_FRAMES_UPDATEFRAME,FrameId, FU_FMPOS); - wnd:=CallService(MS_CLUI_GETHWND{MS_CLUI_GETHWNDTREE},0,0); + wnd:=cli^.hwndContactList; tmp:=SendMessage(wnd,CLM_GETEXSTYLE,0,0); SendMessage(wnd,CLM_SETEXSTYLE,tmp or CLS_EX_SHOWSELALWAYS,0); diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp index d1591e98c4..7f0afc3e37 100644 --- a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp +++ b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp @@ -347,7 +347,7 @@ static int OnShutdown(WPARAM wParam, LPARAM lParam) // set windowstate and docked for next startup if (db_get_b(NULL, MODULENAME, SETTING_SETWINSTATE, 0)) { int state = db_get_b(NULL, MODULENAME, SETTING_WINSTATE, SETTING_STATE_NORMAL); - HWND hClist = (HWND)CallService(MS_CLUI_GETHWND, 0, 0); + HWND hClist = pcli->hwndContactList; BOOL isHidden = !IsWindowVisible(hClist); switch (state) { case SETTING_STATE_HIDDEN: @@ -448,7 +448,7 @@ int CSModuleLoaded(WPARAM wParam, LPARAM lParam) // win size and location if (db_get_b(NULL, MODULENAME, SETTING_SETWINLOCATION, 0) || db_get_b(NULL, MODULENAME, SETTING_SETWINSIZE, 0)) { - HWND hClist = (HWND)CallService(MS_CLUI_GETHWND, 0, 0); + HWND hClist = pcli->hwndContactList; // store in db if (db_get_b(NULL, MODULENAME, SETTING_SETWINLOCATION, 0)) { diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index fa8c3b2bf5..470ba6ec37 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -131,7 +131,7 @@ void CGlobals::reloadSystemModulesChanged() else db_set_b(0, SRMSGMOD_T, "ieview_installed", 0); m_iButtonsBarGap = M.GetByte("ButtonsBarGap", 1); - m_hwndClist = (HWND)CallService(MS_CLUI_GETHWND, 0, 0); + m_hwndClist = pcli->hwndContactList; g_bPopupAvail = ServiceExists(MS_POPUP_ADDPOPUPT) != 0; diff --git a/plugins/TipperYM/src/message_pump.cpp b/plugins/TipperYM/src/message_pump.cpp index fcb719d6f8..8b5a0b1b6b 100644 --- a/plugins/TipperYM/src/message_pump.cpp +++ b/plugins/TipperYM/src/message_pump.cpp @@ -233,7 +233,7 @@ void DeinitMessagePump() INT_PTR ShowTip(WPARAM wParam, LPARAM lParam) { CLCINFOTIP *clcit = (CLCINFOTIP *)lParam; - HWND clist = (HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0); + HWND clist = pcli->hwndContactTree; if (clcit->isGroup) return 0; // no group tips (since they're pretty useless) if (clcit->isTreeFocused == 0 && !opt.bShowNoFocus && clist == WindowFromPoint(clcit->ptCursor)) return 0; @@ -265,7 +265,7 @@ int ShowTipHook(WPARAM wParam, LPARAM lParam) INT_PTR ShowTipW(WPARAM wParam, LPARAM lParam) { CLCINFOTIP *clcit = (CLCINFOTIP *)lParam; - HWND clist = (HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0); + HWND clist = pcli->hwndContactTree; if (clcit->isGroup) return 0; // no group tips (since they're pretty useless) if (clcit->isTreeFocused == 0 && !opt.bShowNoFocus && clist == WindowFromPoint(clcit->ptCursor)) return 0; diff --git a/plugins/TopToolBar/src/InternalButtons.cpp b/plugins/TopToolBar/src/InternalButtons.cpp index fb7566729d..347bbc9620 100644 --- a/plugins/TopToolBar/src/InternalButtons.cpp +++ b/plugins/TopToolBar/src/InternalButtons.cpp @@ -67,7 +67,7 @@ INT_PTR TTBInternalMainMenuButt(WPARAM wParam, LPARAM lParam) POINT pt; GetCursorPos(&pt); - TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, (HWND)CallService(MS_CLUI_GETHWND, 0, 0), NULL); + TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, NULL); return 0; } @@ -77,7 +77,7 @@ INT_PTR TTBInternalStatusMenuButt(WPARAM wParam, LPARAM lParam) POINT pt; GetCursorPos(&pt); - TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, (HWND)CallService(MS_CLUI_GETHWND, 0, 0), NULL); + TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, NULL); return 0; } @@ -106,7 +106,7 @@ INT_PTR TTBInternalShowHideOffline(WPARAM wParam, LPARAM lParam) void InitInternalButtons() { - hwndContactTree = (HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0); + hwndContactTree = pcli->hwndContactTree; CreateServiceFunction(TTBI_GROUPSHOWHIDE, TTBInternalGroupShowHide); CreateServiceFunction(TTBI_SOUNDSONOFF, TTBInternalSoundsOnOff); diff --git a/plugins/TopToolBar/src/common.h b/plugins/TopToolBar/src/common.h index 5819403c81..e5e4ac6e1e 100644 --- a/plugins/TopToolBar/src/common.h +++ b/plugins/TopToolBar/src/common.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include diff --git a/plugins/TopToolBar/src/main.cpp b/plugins/TopToolBar/src/main.cpp index a651684e1f..c30ee22557 100644 --- a/plugins/TopToolBar/src/main.cpp +++ b/plugins/TopToolBar/src/main.cpp @@ -1,6 +1,7 @@ #include "common.h" +CLIST_INTERFACE *pcli; HINSTANCE hInst; int hLangpack; @@ -29,6 +30,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD miranda extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfo); + mir_getCLI(); LoadToolbarModule(); return 0; diff --git a/plugins/TopToolBar/src/toolbarwnd.cpp b/plugins/TopToolBar/src/toolbarwnd.cpp index 9f85e57dac..bce16c1b42 100644 --- a/plugins/TopToolBar/src/toolbarwnd.cpp +++ b/plugins/TopToolBar/src/toolbarwnd.cpp @@ -244,7 +244,7 @@ INT_PTR OnEventFire(WPARAM wParam, LPARAM lParam) CallService(MS_SYSTEM_REMOVEWAIT, wParam, 0); CloseHandle((HANDLE)wParam); - HWND parent = (HWND)CallService(MS_CLUI_GETHWND, 0, 0); + HWND parent = pcli->hwndContactList; if (parent == NULL) // no clist, no buttons return -1; diff --git a/plugins/TrafficCounter/src/TrafficCounter.cpp b/plugins/TrafficCounter/src/TrafficCounter.cpp index 03c63386d2..cf769d01ee 100644 --- a/plugins/TrafficCounter/src/TrafficCounter.cpp +++ b/plugins/TrafficCounter/src/TrafficCounter.cpp @@ -29,6 +29,7 @@ int NumberOfAccounts; HWND TrafficHwnd; HINSTANCE hInst; +CLIST_INTERFACE *pcli; int hLangpack = 0; // Поддержка плагинозависимого перевода. BOOL bPopupExists = FALSE, bVariablesExists = FALSE, bTooltipExists = FALSE; @@ -130,6 +131,7 @@ extern "C" int __declspec(dllexport) Load(void) { // Получаем дескриптор языкового пакета. mir_getLP(&pluginInfoEx); + mir_getCLI(); HookEvent(ME_OPT_INITIALISE, TrafficCounterOptInitialise); HookEvent(ME_SYSTEM_MODULESLOADED, TrafficCounterModulesLoaded); @@ -297,7 +299,7 @@ int TrafficCounterModulesLoaded(WPARAM wParam, LPARAM lParam) HookEvent(ME_NETLIB_FASTRECV, TrafficRecv); HookEvent(ME_NETLIB_FASTSEND, TrafficSend); - CreateTrafficWindow((HWND)CallService(MS_CLUI_GETHWND, 0, 0)); + CreateTrafficWindow(pcli->hwndContactList); UpdateFonts(0, 0); //Load and create fonts here return 0; @@ -376,7 +378,7 @@ int TrafficCounter_PaintCallbackProc(HWND hWnd, HDC hDC, RECT * rcPaint, HRGN rg int TrafficCounter_Draw(HWND hwnd, HDC hDC) { if (hwnd == (HWND)-1) return 0; - if (GetParent(hwnd) == (HWND)CallService(MS_CLUI_GETHWND, 0, 0)) + if (GetParent(hwnd) == pcli->hwndContactList) return PaintTrafficCounterWindow(hwnd, hDC); else InvalidateRect(hwnd, NULL, FALSE); diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp index 87b68032ac..c5ac1b20a8 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp @@ -272,7 +272,7 @@ INT_PTR svcExIm_Group_Service(WPARAM wParam, LPARAM lParam) LPTSTR ptszGroup = tszGroup; LPTSTR ptszItem = tszItem; - HWND hClist = (HWND)CallService(MS_CLUI_GETHWNDTREE,0,0); + HWND hClist = pcli->hwndContactTree; // get clist selection hItem = SendMessage(hClist,CLM_GETSELECTION,0,0); hRoot = SendMessage(hClist,CLM_GETNEXTITEM, (WPARAM)CLGN_ROOT, (LPARAM)hItem); @@ -331,7 +331,7 @@ INT_PTR svcExIm_Account_Service(WPARAM wParam, LPARAM lParam) { ExImParam ExIm; memset(&ExIm, 0, sizeof(ExIm)); - HWND hClist = (HWND)CallService(MS_CLUI_GETHWNDTREE,0,0); + HWND hClist = pcli->hwndContactTree; lpStatusMenuExecParam smep = (lpStatusMenuExecParam)Menu_GetItemData((HGENMENU)lParam); ExIm.pszName = mir_strdup(smep->proto); ExIm.Typ = EXIM_ACCOUNT; diff --git a/plugins/Utils.pas/mircontacts.pas b/plugins/Utils.pas/mircontacts.pas index 15bb6d61a7..5eca8bb927 100644 --- a/plugins/Utils.pas/mircontacts.pas +++ b/plugins/Utils.pas/mircontacts.pas @@ -401,16 +401,14 @@ function SetCListSelContact(hContact:TMCONTACT):TMCONTACT; var wnd:HWND; begin - wnd:=CallService(MS_CLUI_GETHWNDTREE,0,0); + wnd:=cli^.hwndContactTree; result:=hContact; -// hContact:=SendMessage(wnd,CLM_FINDCONTACT ,hContact,0); SendMessage(wnd,CLM_SELECTITEM ,hContact,0); -// SendMessage(wnd,CLM_ENSUREVISIBLE,hContact,0); end; function GetCListSelContact:TMCONTACT; begin - result:=SendMessageW(CallService(MS_CLUI_GETHWNDTREE,0,0),CLM_GETSELECTION,0,0); + result:=SendMessageW(cli^.hwndContactTree,CLM_GETSELECTION,0,0); end; function WndToContact(wnd:HWND):TMCONTACT; diff --git a/plugins/Utils.pas/protocols.pas b/plugins/Utils.pas/protocols.pas index 08b9221711..85fadc4001 100644 --- a/plugins/Utils.pas/protocols.pas +++ b/plugins/Utils.pas/protocols.pas @@ -219,13 +219,11 @@ var item:TLVITEMW; lvc:TLVCOLUMN; i,newItem:integer; - cli:PCLIST_INTERFACE; begin FillChar(lvc,SizeOf(lvc),0); ListView_SetExtendedListViewStyle(list, LVS_EX_CHECKBOXES); if withIcons then begin - cli:=PCLIST_INTERFACE(CallService(MS_CLIST_RETRIEVE_INTERFACE,0,0)); SetWindowLongPtrW(list,GWL_STYLE, GetWindowLongPtrW(list,GWL_STYLE) or LVS_SHAREIMAGELISTS); ListView_SetImageList(list, @@ -277,7 +275,7 @@ end; procedure FillStatusList(proto:uint_ptr;list:HWND;withIcons:bool=false); - procedure AddString(num:integer;enabled:boolean;cli:PCLIST_INTERFACE); + procedure AddString(num:integer;enabled:boolean); var item:LV_ITEMW; newItem:integer; @@ -300,7 +298,6 @@ procedure FillStatusList(proto:uint_ptr;list:HWND;withIcons:bool=false); var lvc:TLVCOLUMN; - cli:PCLIST_INTERFACE; begin if proto=0 then withIcons:=false; @@ -310,7 +307,6 @@ begin ListView_SetExtendedListViewStyle(list, LVS_EX_CHECKBOXES); if withIcons then begin - cli:=PCLIST_INTERFACE(CallService(MS_CLIST_RETRIEVE_INTERFACE,0,0)); SetWindowLongPtrW(list,GWL_STYLE, GetWindowLongPtrW(list,GWL_STYLE) or LVS_SHAREIMAGELISTS); ListView_SetImageList(list, @@ -328,19 +324,19 @@ begin lvc.fmt:={LVCFMT_IMAGE or} LVCFMT_LEFT; ListView_InsertColumn(list,0,lvc); - AddString(0,true,nil); + AddString(0,true); ListView_SetItemState (list,0,LVIS_FOCUSED or LVIS_SELECTED,$000F); with protos^[proto] do begin - if (status and psf_online )<>0 then AddString(1,(enabled and psf_online )<>0,cli); - if (status and psf_invisible )<>0 then AddString(2,(enabled and psf_invisible )<>0,cli); - if (status and psf_shortaway )<>0 then AddString(3,(enabled and psf_shortaway )<>0,cli); - if (status and psf_longaway )<>0 then AddString(4,(enabled and psf_longaway )<>0,cli); - if (status and psf_lightdnd )<>0 then AddString(5,(enabled and psf_lightdnd )<>0,cli); - if (status and psf_heavydnd )<>0 then AddString(6,(enabled and psf_heavydnd )<>0,cli); - if (status and psf_freechat )<>0 then AddString(7,(enabled and psf_freechat )<>0,cli); - if (status and psf_outtolunch)<>0 then AddString(8,(enabled and psf_outtolunch)<>0,cli); - if (status and psf_onthephone)<>0 then AddString(9,(enabled and psf_onthephone)<>0,cli); + if (status and psf_online )<>0 then AddString(1,(enabled and psf_online )<>0); + if (status and psf_invisible )<>0 then AddString(2,(enabled and psf_invisible )<>0); + if (status and psf_shortaway )<>0 then AddString(3,(enabled and psf_shortaway )<>0); + if (status and psf_longaway )<>0 then AddString(4,(enabled and psf_longaway )<>0); + if (status and psf_lightdnd )<>0 then AddString(5,(enabled and psf_lightdnd )<>0); + if (status and psf_heavydnd )<>0 then AddString(6,(enabled and psf_heavydnd )<>0); + if (status and psf_freechat )<>0 then AddString(7,(enabled and psf_freechat )<>0); + if (status and psf_outtolunch)<>0 then AddString(8,(enabled and psf_outtolunch)<>0); + if (status and psf_onthephone)<>0 then AddString(9,(enabled and psf_onthephone)<>0); end; ListView_SetColumnWidth(list,0,LVSCW_AUTOSIZE); end; diff --git a/plugins/Weather/src/weather.cpp b/plugins/Weather/src/weather.cpp index 1a4127fa05..736293406c 100644 --- a/plugins/Weather/src/weather.cpp +++ b/plugins/Weather/src/weather.cpp @@ -40,6 +40,7 @@ HANDLE hHookWeatherError; MWindowList hDataWindowList, hWindowList; HANDLE hUpdateMutex; +CLIST_INTERFACE *pcli; unsigned status; unsigned old_status; @@ -176,6 +177,7 @@ extern "C" int __declspec(dllexport) Unload(void) extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfoEx); + mir_getCLI(); // initialize global variables InitVar(); diff --git a/plugins/Weather/src/weather_mwin.cpp b/plugins/Weather/src/weather_mwin.cpp index cb88a50811..5e24376a91 100644 --- a/plugins/Weather/src/weather_mwin.cpp +++ b/plugins/Weather/src/weather_mwin.cpp @@ -256,7 +256,7 @@ static void addWindow(MCONTACT hContact) db_free(&dbv); HWND hWnd = CreateWindow( _T("WeatherFrame"), _T(""), WS_CHILD | WS_VISIBLE, - 0, 0, 10, 10, (HWND)CallService(MS_CLUI_GETHWND, 0, 0), NULL, hInst, (void*)hContact); + 0, 0, 10, 10, pcli->hwndContactList, NULL, hInst, (void*)hContact); WindowList_Add(hMwinWindowList, hWnd, hContact); CLISTFrame Frame = {0}; diff --git a/plugins/YAPP/src/common.h b/plugins/YAPP/src/common.h index f1305489f0..08b5ba124b 100644 --- a/plugins/YAPP/src/common.h +++ b/plugins/YAPP/src/common.h @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include diff --git a/plugins/YAPP/src/popwin.cpp b/plugins/YAPP/src/popwin.cpp index ac801b8ef4..4229911018 100644 --- a/plugins/YAPP/src/popwin.cpp +++ b/plugins/YAPP/src/popwin.cpp @@ -81,7 +81,7 @@ void AddWindowToStack(HWND hwnd) { SystemParametersInfo(SPI_GETWORKAREA, 0, &wa_rect, 0); if (options.use_mim_monitor) { RECT clr; - GetWindowRect((HWND)CallService(MS_CLUI_GETHWND, 0, 0), &clr); + GetWindowRect(pcli->hwndContactList, &clr); HMONITOR hMonitor = MonitorFromRect(&clr, MONITOR_DEFAULTTONEAREST); if (hMonitor) { MONITORINFO mi; diff --git a/plugins/YAPP/src/yapp.cpp b/plugins/YAPP/src/yapp.cpp index bb2c0065f8..323712e943 100644 --- a/plugins/YAPP/src/yapp.cpp +++ b/plugins/YAPP/src/yapp.cpp @@ -18,7 +18,9 @@ COLORREF colBg = GetSysColor(COLOR_3DSHADOW); HFONT hFontFirstLine = 0, hFontSecondLine = 0, hFontTime = 0; COLORREF colFirstLine = RGB(255, 0, 0), colSecondLine = 0, colTime = RGB(0, 0, 255), colBorder = RGB(0, 0, 0), colSidebar = RGB(128, 128, 128), colTitleUnderline = GetSysColor(COLOR_3DSHADOW); + int hLangpack; +CLIST_INTERFACE *pcli; // toptoolbar button HANDLE hTTButton; @@ -219,6 +221,7 @@ int PreShutdown(WPARAM wParam, LPARAM lParam) extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfo); + mir_getCLI(); InitMessagePump(); InitOptions(); diff --git a/plugins/ZeroSwitch/src/ZeroSwitch.cpp b/plugins/ZeroSwitch/src/ZeroSwitch.cpp index 20dd9d86d7..651eb7ff77 100644 --- a/plugins/ZeroSwitch/src/ZeroSwitch.cpp +++ b/plugins/ZeroSwitch/src/ZeroSwitch.cpp @@ -7,6 +7,7 @@ HINSTANCE hInst; HHOOK hHook; HWND hDummyWnd = NULL, hHelperWnd = NULL, hMirandaWnd = NULL; int hLangpack; +CLIST_INTERFACE *pcli; PLUGININFOEX pluginInfo = { sizeof(PLUGININFOEX), @@ -113,7 +114,7 @@ LRESULT CALLBACK CallWndRetProc(int nCode, WPARAM wParam, LPARAM lParam) { pMes = (PCWPRETSTRUCT)lParam; // Get message details if (!hMirandaWnd) - hMirandaWnd = (HWND) CallService(MS_CLUI_GETHWND,0,0);//FindWindow(_T("Miranda"), NULL); + hMirandaWnd = pcli->hwndContactList; if (pMes->hwnd == hMirandaWnd) { @@ -132,6 +133,7 @@ LRESULT CALLBACK CallWndRetProc(int nCode, WPARAM wParam, LPARAM lParam) extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfo); + mir_getCLI(); if (IsWinVerVistaPlus()) { MessageBox(NULL, TranslateT("Plugin works under Windows XP only"), TranslateT("ZeroSwitch plugin failed"), MB_ICONSTOP); diff --git a/plugins/ZeroSwitch/src/stdafx.h b/plugins/ZeroSwitch/src/stdafx.h index 2531d2596b..8f36ebb340 100644 --- a/plugins/ZeroSwitch/src/stdafx.h +++ b/plugins/ZeroSwitch/src/stdafx.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include diff --git a/plugins/mRadio/rframeapi.pas b/plugins/mRadio/rframeapi.pas index 6888c3965d..2db900efe6 100644 --- a/plugins/mRadio/rframeapi.pas +++ b/plugins/mRadio/rframeapi.pas @@ -210,7 +210,7 @@ begin if ServiceExists(MS_CLIST_FRAMES_ADDFRAME)=0 then exit; if parent=0 then - parent:=CallService(MS_CLUI_GETHWND,0,0); + parent:=cli^.hwndContactList; if FrameWnd=0 then FrameWnd:=CreateDialog(hInstance,MAKEINTRESOURCE(IDD_FRAME),parent,@RadioFrameProc); @@ -236,7 +236,7 @@ begin begin CallService(MS_CLIST_FRAMES_UPDATEFRAME,FrameId, FU_FMPOS); - wnd:=CallService(MS_CLUI_GETHWND{MS_CLUI_GETHWNDTREE},0,0); + wnd:=cli^.hwndContactList; tmp:=SendMessage(wnd,CLM_GETEXSTYLE,0,0); SendMessage(wnd,CLM_SETEXSTYLE,tmp or CLS_EX_SHOWSELALWAYS,0); -- cgit v1.2.3