aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/Library/ml_devices/common.h
diff options
context:
space:
mode:
authorJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
committerJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
commit20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Plugins/Library/ml_devices/common.h
parent537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff)
downloadwinamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz
Initial community commit
Diffstat (limited to 'Src/Plugins/Library/ml_devices/common.h')
-rw-r--r--Src/Plugins/Library/ml_devices/common.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/Src/Plugins/Library/ml_devices/common.h b/Src/Plugins/Library/ml_devices/common.h
new file mode 100644
index 00000000..8713a2bd
--- /dev/null
+++ b/Src/Plugins/Library/ml_devices/common.h
@@ -0,0 +1,76 @@
+#ifndef _NULLSOFT_WINAMP_ML_DEVICES_COMMON_HEADER
+#define _NULLSOFT_WINAMP_ML_DEVICES_COMMON_HEADER
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once
+#endif
+
+#ifndef LONGX86
+#ifdef _WIN64
+ #define LONGX86 LONG_PTR
+#else /*_WIN64*/
+ #define LONGX86 LONG
+#endif /*_WIN64*/
+#endif // LONGX86
+
+#define CSTR_INVARIANT MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)
+
+#ifdef __cplusplus
+ #define SENDMSG(__hwnd, __msgId, __wParam, __lParam) ::SendMessageW((__hwnd), (__msgId), (__wParam), (__lParam))
+#else
+ #define SENDMSG(__hwnd, __msgId, __wParam, __lParam) SendMessageW((__hwnd), (__msgId), (__wParam), (__lParam))
+#endif // __cplusplus
+
+#define SENDMLIPC(__hwndML, __ipcMsgId, __param) SENDMSG((__hwndML), WM_ML_IPC, (WPARAM)(__param), (LPARAM)(__ipcMsgId))
+
+#define SENDWAIPC(__hwndWA, __ipcMsgId, __param) SENDMSG((__hwndWA), WM_WA_IPC, (WPARAM)(__param), (LPARAM)(__ipcMsgId))
+
+#define SENDCMD(__hwnd, __ctrlId, __eventId, __hctrl) (SENDMSG((__hwnd), WM_COMMAND, MAKEWPARAM(__ctrlId, __eventId), (LPARAM)(__hctrl)))
+
+#define DIALOG_RESULT(__hwnd, __result) { SetWindowLongPtrW((__hwnd), DWLP_MSGRESULT, ((LONGX86)(LONG_PTR)(__result))); return TRUE; }
+
+#ifndef GetWindowStyle
+ #define GetWindowStyle(__hwnd) ((UINT)GetWindowLongPtr((__hwnd), GWL_STYLE))
+#endif //GetWindowStyle
+
+#ifndef SetWindowStyle
+ #define SetWindowStyle(__hwnd, __style) (SetWindowLongPtr((__hwnd), GWL_STYLE, (__style)))
+#endif //SetWindowStyle
+
+#ifndef GetWindowStyleEx
+ #define GetWindowStyleEx(__hwnd) ((UINT)GetWindowLongPtr((__hwnd), GWL_EXSTYLE))
+#endif // GetWindowStyleEx
+
+#ifndef SetWindowStyleEx
+ #define SetWindowStyleEx(__hwnd, __style) (SetWindowLongPtr((__hwnd), GWL_EXSTYLE, (__style)))
+#endif //SetWindowStyle
+
+#ifndef RECTWIDTH
+ #define RECTWIDTH(__r) ((__r).right - (__r).left)
+#endif
+
+#ifndef RECTHEIGHT
+ #define RECTHEIGHT(__r) ((__r).bottom - (__r).top)
+#endif
+
+#undef CLAMP
+#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
+
+#ifndef ARRAYSIZE
+ #define ARRAYSIZE(_a) (sizeof(_a)/sizeof((_a)[0]))
+#endif
+
+#ifndef ABS
+ #define ABS(x) (((x) > 0) ? (x) : (-x))
+#endif
+
+#ifndef MIN
+ #define MIN(v1, v2) (((v1) < (v2)) ? (v1) : (v2))
+#endif
+
+#ifndef MAX
+ #define MAX(v1, v2) (((v1) > (v2)) ? (v1) : (v2))
+#endif
+
+
+#endif //_NULLSOFT_WINAMP_ML_DEVICES_COMMON_HEADER