From 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d Mon Sep 17 00:00:00 2001 From: Jef Date: Tue, 24 Sep 2024 14:54:57 +0200 Subject: Initial community commit --- Src/Plugins/General/gen_ml/reflectmsg.h | 50 +++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Src/Plugins/General/gen_ml/reflectmsg.h (limited to 'Src/Plugins/General/gen_ml/reflectmsg.h') diff --git a/Src/Plugins/General/gen_ml/reflectmsg.h b/Src/Plugins/General/gen_ml/reflectmsg.h new file mode 100644 index 00000000..1e7224c6 --- /dev/null +++ b/Src/Plugins/General/gen_ml/reflectmsg.h @@ -0,0 +1,50 @@ +#ifndef NULLOSFT_MEDIALIBRARY_REFLECTED_MESSAGES_HEADER +#define NULLOSFT_MEDIALIBRARY_REFLECTED_MESSAGES_HEADER + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +#include + +// reflected messages will pass this as lParam +typedef struct _REFLECTPARAM +{ + LRESULT result; // return result here. If refleting window is dialog it is responsible to set result using SetWindowlongPtr. + LPARAM lParam; // orginal lParam + HWND hwndFrom; // reflecting window +}REFLECTPARAM, *PREFLECTPARAM; + + + +// reflected messages +// you need to return TRUE if you procesed a message otherwise FALSE +#define REFLECT_BASE (WM_APP + 0x3000) + +#define WM_SUPPORTREFLECT (REFLECT_BASE + 0x0000) // wParam = (WPARM)(UINT)testMessageCode. Return TRUE if you suport message reflecting + +#define REFLECTED_DRAWITEM (REFLECT_BASE + WM_DRAWITEM) +#define REFLECTED_CTLCOLORBTN (REFLECT_BASE + WM_CTLCOLORBTN) +#define REFLECTED_CTLCOLOREDIT (REFLECT_BASE + WM_CTLCOLOREDIT) +#define REFLECTED_CTLCOLORLISTBOX (REFLECT_BASE + WM_CTLCOLORLISTBOX) +#define REFLECTED_CTLCOLORSCROLLBAR (REFLECT_BASE + WM_CTLCOLORSCROLLBAR) +#define REFLECTED_CTLCOLORSTATIC (REFLECT_BASE + WM_CTLCOLORSTATIC) +#define REFLECTED_NOTIFY (REFLECT_BASE + WM_NOTIFY) +#define REFLECTED_COMMAND (REFLECT_BASE + WM_COMMAND) +#define REFLECTED_MEASUREITEM (REFLECT_BASE + WM_MEASUREITEM) + + +#ifdef __cplusplus +#define REFLECTMESSAGE(hwnd, uMsg, wParam, lParam) (BOOL)::SendMessage((hwnd), (REFLECT_BASE + (uMsg)), (wParam), (lParam)) +#else +#define REFLECTMESSAGE(hwnd, uMsg, wParam, lParam) (BOOL)SendMessage((hwnd), (REFLECT_BASE + (uMsg)), (wParam), (lParam)) +#endif + +BOOL CanReflect(UINT uMsg); +BOOL ReflectMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL bDialog, LRESULT *pResult); + +HRESULT InstallReflector(HWND hwnd); // this is installs simple window hook that allows reflection code to run. + // returns , S_OK - hook installed, S_FALSE in case hook already installed, E_XXX - something bad +BOOL RemoveReflector(HWND hwnd); // returns TRUE if window was reflecting + +#endif // NULLOSFT_MEDIALIBRARY_REFLECTED_MESSAGES_HEADER -- cgit