aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/General/gen_ml/reflectmsg.h
blob: 1e7224c6e8ef11352c6854be06085acbc794f253 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef NULLOSFT_MEDIALIBRARY_REFLECTED_MESSAGES_HEADER
#define NULLOSFT_MEDIALIBRARY_REFLECTED_MESSAGES_HEADER

#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif

#include <windows.h>

// 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