1
0

common.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #ifndef NULLSOFT_WEBDEV_PLUGIN_COMMON_HEADER
  2. #define NULLSOFT_WEBDEV_PLUGIN_COMMON_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #include <wtypes.h>
  7. #include "../nu/trace.h"
  8. #define CSTR_INVARIANT MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)
  9. #ifndef ARRAYSIZE
  10. #define ARRAYSIZE(blah) (sizeof(blah)/sizeof(*blah))
  11. #endif
  12. #ifndef LONGX86
  13. #ifdef _WIN64
  14. #define LONGX86 LONG_PTR
  15. #else /*_WIN64*/
  16. #define LONGX86 LONG
  17. #endif /*_WIN64*/
  18. #endif // LONGX86
  19. #ifdef __cplusplus
  20. #define SENDMSG(__hwnd, __msgId, __wParam, __lParam) ::SendMessageW((__hwnd), (__msgId), (__wParam), (__lParam))
  21. #else
  22. #define SENDMSG(__hwnd, __msgId, __wParam, __lParam) SendMessageW((__hwnd), (__msgId), (__wParam), (__lParam))
  23. #endif // __cplusplus
  24. #define SENDMLIPC(__hwndML, __ipcMsgId, __param) SENDMSG((__hwndML), WM_ML_IPC, (WPARAM)(__param), (LPARAM)(__ipcMsgId))
  25. #define SENDWAIPC(__hwndWA, __ipcMsgId, __param) SENDMSG((__hwndWA), WM_WA_IPC, (WPARAM)(__param), (LPARAM)(__ipcMsgId))
  26. #define MSGRESULT(__hwnd, __result) { SetWindowLongPtrW((__hwnd), DWLP_MSGRESULT, ((LONGX86)(LONG_PTR)(__result))); return TRUE; }
  27. #define SENDCMD(__hwnd, __ctrlId, __eventId, __hctrl) (SENDMSG((__hwnd), WM_COMMAND, MAKEWPARAM(__ctrlId, __eventId), (LPARAM)(__hctrl)))
  28. #ifndef GetWindowStyle
  29. #define GetWindowStyle(__hwnd) ((UINT)GetWindowLongPtr((__hwnd), GWL_STYLE))
  30. #endif //GetWindowStyle
  31. #ifndef GetWindowStyleEx
  32. #define GetWindowStyleEx(__hwnd) ((UINT)GetWindowLongPtr((__hwnd), GWL_EXSTYLE))
  33. #endif // GetWindowStyleEx
  34. LPWSTR Plugin_MallocString(size_t cchLen);
  35. LPWSTR Plugin_ReAllocString(LPWSTR pszString, size_t cchLen);
  36. void Plugin_FreeString(LPWSTR pszString);
  37. LPWSTR Plugin_CopyString(LPCWSTR pszSource);
  38. LPSTR Plugin_MallocAnsiString(size_t cchLen);
  39. LPSTR Plugin_CopyAnsiString(LPCSTR pszSource);
  40. void Plugin_FreeAnsiString(LPSTR pszString);
  41. LPWSTR Plugin_DuplicateResString(LPCWSTR pszResource);
  42. void Plugin_FreeResString(LPWSTR pszResource);
  43. HRESULT Plugin_CopyResString(LPWSTR pszBuffer, INT cchBufferMax, LPCWSTR pszString);
  44. LPSTR Plugin_WideCharToMultiByte(UINT codePage, DWORD dwFlags, LPCWSTR lpWideCharStr, INT cchWideChar, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar);
  45. LPWSTR Plugin_MultiByteToWideChar(UINT codePage, DWORD dwFlags, LPCSTR lpMultiByteStr, INT cbMultiByte);
  46. void Plugin_SafeRelease(IUnknown *pUnk);
  47. HRESULT Plugin_MakeResourcePath(LPWSTR pszBuffer, INT cchBufferMax, LPCWSTR pszType, LPCWSTR pszName, UINT uFlags);
  48. HWND Plugin_GetDialogOwner(void);
  49. HRESULT Plugin_AppendFileFilter(LPTSTR pszBuffer, size_t cchBufferMax, LPCTSTR pName, LPCTSTR pFilter, LPTSTR *ppBufferOut, size_t *pRemaining, BOOL bShowFilter);
  50. #endif //NULLSOFT_WEBDEV_PLUGIN_COMMON_HEADER