1
0

reflectmsg.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef NULLOSFT_MEDIALIBRARY_REFLECTED_MESSAGES_HEADER
  2. #define NULLOSFT_MEDIALIBRARY_REFLECTED_MESSAGES_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #include <windows.h>
  7. // reflected messages will pass this as lParam
  8. typedef struct _REFLECTPARAM
  9. {
  10. LRESULT result; // return result here. If refleting window is dialog it is responsible to set result using SetWindowlongPtr.
  11. LPARAM lParam; // orginal lParam
  12. HWND hwndFrom; // reflecting window
  13. }REFLECTPARAM, *PREFLECTPARAM;
  14. // reflected messages
  15. // you need to return TRUE if you procesed a message otherwise FALSE
  16. #define REFLECT_BASE (WM_APP + 0x3000)
  17. #define WM_SUPPORTREFLECT (REFLECT_BASE + 0x0000) // wParam = (WPARM)(UINT)testMessageCode. Return TRUE if you suport message reflecting
  18. #define REFLECTED_DRAWITEM (REFLECT_BASE + WM_DRAWITEM)
  19. #define REFLECTED_CTLCOLORBTN (REFLECT_BASE + WM_CTLCOLORBTN)
  20. #define REFLECTED_CTLCOLOREDIT (REFLECT_BASE + WM_CTLCOLOREDIT)
  21. #define REFLECTED_CTLCOLORLISTBOX (REFLECT_BASE + WM_CTLCOLORLISTBOX)
  22. #define REFLECTED_CTLCOLORSCROLLBAR (REFLECT_BASE + WM_CTLCOLORSCROLLBAR)
  23. #define REFLECTED_CTLCOLORSTATIC (REFLECT_BASE + WM_CTLCOLORSTATIC)
  24. #define REFLECTED_NOTIFY (REFLECT_BASE + WM_NOTIFY)
  25. #define REFLECTED_COMMAND (REFLECT_BASE + WM_COMMAND)
  26. #define REFLECTED_MEASUREITEM (REFLECT_BASE + WM_MEASUREITEM)
  27. #ifdef __cplusplus
  28. #define REFLECTMESSAGE(hwnd, uMsg, wParam, lParam) (BOOL)::SendMessage((hwnd), (REFLECT_BASE + (uMsg)), (wParam), (lParam))
  29. #else
  30. #define REFLECTMESSAGE(hwnd, uMsg, wParam, lParam) (BOOL)SendMessage((hwnd), (REFLECT_BASE + (uMsg)), (wParam), (lParam))
  31. #endif
  32. BOOL CanReflect(UINT uMsg);
  33. BOOL ReflectMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL bDialog, LRESULT *pResult);
  34. HRESULT InstallReflector(HWND hwnd); // this is installs simple window hook that allows reflection code to run.
  35. // returns , S_OK - hook installed, S_FALSE in case hook already installed, E_XXX - something bad
  36. BOOL RemoveReflector(HWND hwnd); // returns TRUE if window was reflecting
  37. #endif // NULLOSFT_MEDIALIBRARY_REFLECTED_MESSAGES_HEADER