common.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef NULLSOFT_WINAMP_OMBROWSER_COMMON_HEADER
  2. #define NULLSOFT_WINAMP_OMBROWSER_COMMON_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #ifndef _WIN32_IE_IE70
  7. #define _WIN32_IE_IE70 0x0700
  8. #endif //_WIN32_IE_IE70
  9. #include <wtypes.h>
  10. #include "../nu/trace.h"
  11. #define CSTR_INVARIANT MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)
  12. #ifndef ARRAYSIZE
  13. #define ARRAYSIZE(blah) (sizeof(blah)/sizeof(*blah))
  14. #endif
  15. #ifndef LONGX86
  16. #ifdef _WIN64
  17. #define LONGX86 LONG_PTR
  18. #else /*_WIN64*/
  19. #define LONGX86 LONG
  20. #endif /*_WIN64*/
  21. #endif // LONGX86
  22. #define __WTEXT(quote) L##quote
  23. #define WTEXT(quote) __WTEXT(quote)
  24. #ifdef __cplusplus
  25. #define SENDMSG(__hwnd, __msgId, __wParam, __lParam) ::SendMessageW((__hwnd), (__msgId), (__wParam), (__lParam))
  26. #else
  27. #define SENDMSG(__hwnd, __msgId, __wParam, __lParam) SendMessageW((__hwnd), (__msgId), (__wParam), (__lParam))
  28. #endif // __cplusplus
  29. #define SENDMLIPC(__hwndML, __ipcMsgId, __param) SENDMSG((__hwndML), WM_ML_IPC, (WPARAM)(__param), (LPARAM)(__ipcMsgId))
  30. #define SENDWAIPC(__hwndWA, __ipcMsgId, __param) SENDMSG((__hwndWA), WM_WA_IPC, (WPARAM)(__param), (LPARAM)(__ipcMsgId))
  31. #define MSGRESULT(__hwnd, __result) { SetWindowLongPtrW((__hwnd), DWLP_MSGRESULT, ((LONGX86)(LONG_PTR)(__result))); return TRUE; }
  32. #define SENDCMD(__hwnd, __ctrlId, __eventId, __hctrl) (SENDMSG((__hwnd), WM_COMMAND, MAKEWPARAM(__ctrlId, __eventId), (LPARAM)(__hctrl)))
  33. #ifndef GetWindowStyle
  34. #define GetWindowStyle(__hwnd) ((UINT)GetWindowLongPtr((__hwnd), GWL_STYLE))
  35. #endif //GetWindowStyle
  36. #ifndef GetWindowStyleEx
  37. #define GetWindowStyleEx(__hwnd) ((UINT)GetWindowLongPtr((__hwnd), GWL_EXSTYLE))
  38. #endif // GetWindowStyleEx
  39. #endif //NULLSOFT_WINAMP_OMBROWSER_COMMON_HEADER