From 0f8566dd046d34ea0ff6b747f7383ffb17f6761e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 14 Jun 2015 21:33:38 +0000 Subject: WindowList_* functions are not services anymore; unneeded helpers removed git-svn-id: http://svn.miranda-ng.org/main/trunk@14168 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/delphi/m_helpers.inc | 36 ---------------------- include/delphi/m_utils.inc | 48 +++++++++++++++-------------- include/m_protoint.h | 19 ++++++------ include/m_utils.h | 73 ++++++++++---------------------------------- 4 files changed, 51 insertions(+), 125 deletions(-) (limited to 'include') diff --git a/include/delphi/m_helpers.inc b/include/delphi/m_helpers.inc index 550a766780..9fbd21c671 100644 --- a/include/delphi/m_helpers.inc +++ b/include/delphi/m_helpers.inc @@ -28,10 +28,6 @@ function Netlib_Send(hConn: THANDLE; const buf: PAnsiChar; len: int; flags: int) function Netlib_Recv(hConn: THANDLE; const buf: PAnsiChar; len: int; flags: int): int_ptr; procedure Netlib_Log(hNetLib: THANDLE; const sz: PAnsiChar); -function WindowList_Add (hList:THANDLE; hWnd:HWND; hContact:TMCONTACT): int_ptr; -function WindowList_Remove (hList:THANDLE; hWnd:HWND): int_ptr; -function WindowList_Find (hList:THANDLE; hContact:TMCONTACT): int_ptr; -function WindowList_Broadcast(hList:THANDLE; message: int; wParam: WPARAM; lParam: LPARAM): int_ptr; function Utils_SaveWindowPosition (hWnd:HWND; hContact:TMCONTACT; const szModule, szNamePrefix: PAnsiChar): int_ptr; function Utils_RestoreWindowPosition(hWnd:HWND; hContact:TMCONTACT; Flags: int; const szModule, szNamePrefix: PAnsiChar): int_ptr; @@ -252,38 +248,6 @@ begin end; -function WindowList_Add(hList: THANDLE; hWnd: HWND; hContact: TMCONTACT): int_ptr; -var - wle: TWINDOWLISTENTRY; -begin - wle.hList := hList; - wle.hWnd := hWnd; - wle.hContact := hContact; - Result := CallService(MS_UTILS_ADDTOWINDOWLIST, 0, lParam(@wle)); -end; - -function WindowList_Remove(hList: THANDLE; hWnd: HWND): int_ptr; - {$IFDEF AllowInline}inline;{$ENDIF} -begin - Result := CallService(MS_UTILS_REMOVEFROMWINDOWLIST, hList, hWnd); -end; - -function WindowList_Find(hList: THANDLE; hContact: TMCONTACT): int_ptr; - {$IFDEF AllowInline}inline;{$ENDIF} -begin - Result := CallService(MS_UTILS_FINDWINDOWINLIST, hList, hContact); -end; - -function WindowList_Broadcast(hList: THANDLE; message: int; wParam: WPARAM; lParam: LPARAM): int_ptr; -var - msg: TMSG; -begin - msg.message := message; - msg.wParam := wParam; - msg.lParam := lParam; - Result := CallService(MS_UTILS_BROADCASTTOWINDOWLIST, hList, tLparam(@Msg)); -end; - function Utils_SaveWindowPosition(hWnd:HWND; hContact:TMCONTACT; const szModule, szNamePrefix: PAnsiChar): int_ptr; var swp: TSAVEWINDOWPOS; diff --git a/include/delphi/m_utils.inc b/include/delphi/m_utils.inc index 8308d0f815..d241a91aa3 100644 --- a/include/delphi/m_utils.inc +++ b/include/delphi/m_utils.inc @@ -159,59 +159,59 @@ const } MS_UTILS_GETCOUNTRYLIST:PAnsiChar = 'Utils/GetCountryList'; - //******************************* Window lists ******************************* { - wParam : 0 - lParam : 0 Affect : Allocate a window list Returns: A handle to the new window list } - MS_UTILS_ALLOCWINDOWLIST:PAnsiChar = 'Utils/AllocWindowList'; + +function WindowList_Create() : Thandle; stdcall; + external CoreDLL name 'WindowList_Create'; + +procedure WindowList_Destroy(hList:Thandle); stdcall; + external CoreDLL name 'WindowList_Destroy'; { - wParam : 0 - lParam : Pointer to an initalised TWINDOWLISTENTRY structure Affect : Add a window to a given window list handle Returns: 0 on success, [non zero] on failure } - MS_UTILS_ADDTOWINDOWLIST:PAnsiChar = 'Utils/AddToWindowList'; + +function WindowList_Add(hList:Thandle; hwnd:HWND; hContact:TMCONTACT) : int; stdcall; + external CoreDLL name 'WindowList_Add'; { - wParam : Handle to window list to remove from - lParam : Window handle to remove Affect : Remove a window from the specified window list Returns: 0 on success, [non zero] on failure } - MS_UTILS_REMOVEFROMWINDOWLIST:PAnsiChar = 'Utils/RemoveFromWindowList'; + +function WindowList_Remove(hList:Thandle; hwnd:HWND) : int; stdcall; + external CoreDLL name 'WindowList_Remove'; { - wParam : Handle to the window list to look in - lParam : Handle to a TMCONTACT to find in the window list Affect : Find a window handle given the hContact Returns: The found window handle or NULL(0) on failure } - MS_UTILS_FINDWINDOWINLIST:PAnsiChar = 'Utils/FindWindowInList'; + +function WindowList_Find(hList:Thandle; hContact:TMCONTACT) : HWND; stdcall; + external CoreDLL name 'WindowList_Find'; { - wParam : Handle to window list - lParam : Pointer to TMSG (initalised with what to broadcast) Affect : sends a message to all windows in a list using SendMessage Returns: 0 on success, [non zero] on failure - Notes : only TMSG.Message, .wParam, .lParam are used } - MS_UTILS_BROADCASTTOWINDOWLIST:PAnsiChar = 'Utils/BroadcastToWindowList'; + +function WindowList_Broadcast(hList:Thandle; message:UINT; wParam:TWPARAM; lParam:TLPARAM) : int; stdcall; + external CoreDLL name 'WindowList_Broadcast'; { - Inline helper: WindowList_BroadcastAsync - wParam : Handle to window list - lParam : Pointer to TMSG (initalised with what to broadcast) - Affect : Sends a message to all windows in a list using PostMessage - Returns: 0 on success, nonzero on failure, this service does not fail, + Affect : Sends a message to all windows in a list using PostMessage + Returns: 0 on success, nonzero on failure, this service does not fail, even if PostMessage() fails for whatever reason } - MS_UTILS_BROADCASTTOWINDOWLIST_ASYNC:PAnsiChar = 'Utils/BroadcastToWindowListAsync'; + +function WindowList_BroadcastAsync(hList:Thandle; message:UINT; wParam:TWPARAM; lParam:TLPARAM) : int; stdcall; + external CoreDLL name 'WindowList_BroadcastAsync'; { There aren't any services here, there's no need for them, the control class @@ -221,6 +221,8 @@ const These are defined by STATIC controls and STN_CLICKED is sent to standard STATIC classes when they're clicked -- look at WINAPI docs for more info } + +const WNDCLASS_HYPERLINK = 'Hyperlink'; { diff --git a/include/m_protoint.h b/include/m_protoint.h index fd95329252..1e75d08e15 100644 --- a/include/m_protoint.h +++ b/include/m_protoint.h @@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include +#include typedef enum { @@ -45,15 +46,15 @@ typedef enum struct MIR_CORE_EXPORT PROTO_INTERFACE : public MZeroedObject { - int m_iStatus, // current protocol status - m_iDesiredStatus, // status to be set after logging in - m_iXStatus, // extanded status - m_iVersion; // version 2 or higher designate support of Unicode services - TCHAR* m_tszUserName; // human readable protocol's name - char* m_szModuleName; // internal protocol name, also its database module name - HANDLE m_hProtoIcon; // icon to be displayed in the account manager - HANDLE m_hNetlibUser; // network agent - HANDLE m_hWindowList; // list of all windows which belong to this protocol's instance + int m_iStatus, // current protocol status + m_iDesiredStatus, // status to be set after logging in + m_iXStatus, // extanded status + m_iVersion; // version 2 or higher designate support of Unicode services + TCHAR* m_tszUserName; // human readable protocol's name + char* m_szModuleName; // internal protocol name, also its database module name + HANDLE m_hProtoIcon; // icon to be displayed in the account manager + HANDLE m_hNetlibUser; // network agent + MWindowList m_hWindowList; // list of all windows which belong to this protocol's instance ////////////////////////////////////////////////////////////////////////////////////// // Helpers diff --git a/include/m_utils.h b/include/m_utils.h index 3f716cc069..4e779871a5 100644 --- a/include/m_utils.h +++ b/include/m_utils.h @@ -138,96 +138,55 @@ struct CountryListEntry { }; #define MS_UTILS_GETCOUNTRYLIST "Utils/GetCountryList" -/******************************* Window lists *******************************/ +///////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////// Window lists ////////////////////////////////////// + +#if defined(MIR_CORE_EXPORTS) +typedef struct TWindowList *MWindowList; +#else +DECLARE_HANDLE(MWindowList); +#endif ///////////////////////////////////////////////////////////////////////////////////////// // allocates a window list -// wParam = lParam = 0 (unused) // returns a handle to the new window list -#define MS_UTILS_ALLOCWINDOWLIST "Utils/AllocWindowList" -__forceinline HANDLE WindowList_Create(void) -{ return (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); -} +EXTERN_C MIR_CORE_DLL(MWindowList) WindowList_Create(void); ///////////////////////////////////////////////////////////////////////////////////////// // destroys a window list -// wParam = (HANDLE) window list handle -// lParam = 0 (unused) -// returns a handle to the new window list -#define MS_UTILS_DESTROYWINDOWLIST "Utils/DestroyWindowList" -__forceinline HANDLE WindowList_Destroy(HANDLE hList) -{ return (HANDLE)CallService(MS_UTILS_DESTROYWINDOWLIST, (WPARAM)hList, 0); -} + +EXTERN_C MIR_CORE_DLL(void) WindowList_Destroy(MWindowList hList); ///////////////////////////////////////////////////////////////////////////////////////// // adds a window to the specified window list -// wParam = 0 -// lParam = (LPARAM)(WINDOWLISTENTRY*)&wle // returns 0 on success, nonzero on failure -typedef struct { - HANDLE hList; - HWND hwnd; - MCONTACT hContact; -} WINDOWLISTENTRY; -#define MS_UTILS_ADDTOWINDOWLIST "Utils/AddToWindowList" -__forceinline INT_PTR WindowList_Add(HANDLE hList, HWND hwnd, MCONTACT hContact) { - WINDOWLISTENTRY wle; - wle.hList = hList; wle.hwnd = hwnd; wle.hContact = hContact; - return CallService(MS_UTILS_ADDTOWINDOWLIST, 0, (LPARAM)&wle); -} +EXTERN_C MIR_CORE_DLL(int) WindowList_Add(MWindowList hList, HWND hwnd, MCONTACT hContact); ///////////////////////////////////////////////////////////////////////////////////////// // removes a window from the specified window list -// wParam = (WPARAM)(HANDLE)hList -// lParam = (LPARAM)(HWND)hwnd // returns 0 on success, nonzero on failure -#define MS_UTILS_REMOVEFROMWINDOWLIST "Utils/RemoveFromWindowList" -__forceinline INT_PTR WindowList_Remove(HANDLE hList, HWND hwnd) { - return CallService(MS_UTILS_REMOVEFROMWINDOWLIST, (WPARAM)hList, (LPARAM)hwnd); -} +EXTERN_C MIR_CORE_DLL(int) WindowList_Remove(MWindowList hList, HWND hwnd); ///////////////////////////////////////////////////////////////////////////////////////// // finds a window given the hContact -// wParam = (WPARAM)(HANDLE)hList -// lParam = (MCONTACT)hContact // returns the window handle on success, or NULL on failure -#define MS_UTILS_FINDWINDOWINLIST "Utils/FindWindowInList" -__forceinline HWND WindowList_Find(HANDLE hList, MCONTACT hContact) { - return (HWND)CallService(MS_UTILS_FINDWINDOWINLIST, (WPARAM)hList, hContact); -} +EXTERN_C MIR_CORE_DLL(HWND) WindowList_Find(MWindowList hList, MCONTACT hContact); ///////////////////////////////////////////////////////////////////////////////////////// // sends a message to all windows in a list using SendMessage -// wParam = (WPARAM)(HANDLE)hList -// lParam = (LPARAM)(MSG*)&msg // returns 0 on success, nonzero on failure -// Only msg.message, msg.wParam and msg.lParam are used -#define MS_UTILS_BROADCASTTOWINDOWLIST "Utils/BroadcastToWindowList" -__forceinline INT_PTR WindowList_Broadcast(HANDLE hList, UINT message, WPARAM wParam, LPARAM lParam) { - MSG msg; - msg.message = message; msg.wParam = wParam; msg.lParam = lParam; - return CallService(MS_UTILS_BROADCASTTOWINDOWLIST, (WPARAM)hList, (LPARAM)&msg); -} +EXTERN_C MIR_CORE_DLL(int) WindowList_Broadcast(MWindowList hList, UINT message, WPARAM wParam, LPARAM lParam); ///////////////////////////////////////////////////////////////////////////////////////// // sends a message to all windows in a list using PostMessage -// wParam = (WPARAM)(HANDLE)hList -// lParam = (LPARAM)(MSG*)&msg // returns 0 on success, nonzero on failure -// Only msg.message, msg.wParam and msg.lParam are used -#define MS_UTILS_BROADCASTTOWINDOWLIST_ASYNC "Utils/BroadcastToWindowListAsync" - -__forceinline INT_PTR WindowList_BroadcastAsync(HANDLE hList, UINT message, WPARAM wParam, LPARAM lParam) { - MSG msg; - msg.message = message; msg.wParam = wParam; msg.lParam = lParam; - return CallService(MS_UTILS_BROADCASTTOWINDOWLIST_ASYNC, (WPARAM)hList, (LPARAM)&msg); -} +EXTERN_C MIR_CORE_DLL(int) WindowList_BroadcastAsync(MWindowList hList, UINT message, WPARAM wParam, LPARAM lParam); /***************************** Hyperlink windows ********************************/ -- cgit v1.2.3