wrapwin.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/msw/wrapwin.h
  3. // Purpose: Wrapper around <windows.h>, to be included instead of it
  4. // Author: Vaclav Slavik
  5. // Created: 2003/07/22
  6. // Copyright: (c) 2003 Vaclav Slavik
  7. // Licence: wxWindows licence
  8. /////////////////////////////////////////////////////////////////////////////
  9. #ifndef _WX_WRAPWIN_H_
  10. #define _WX_WRAPWIN_H_
  11. #include "wx/platform.h"
  12. // strict type checking to detect conversion from HFOO to HBAR at compile-time
  13. #ifndef STRICT
  14. #define STRICT 1
  15. #endif
  16. // this macro tells windows.h to not define min() and max() as macros: we need
  17. // this as otherwise they conflict with standard C++ functions
  18. #ifndef NOMINMAX
  19. #define NOMINMAX
  20. #endif // NOMINMAX
  21. // before including windows.h, define version macros at (currently) maximal
  22. // values because we do all our checks at run-time anyhow
  23. #ifndef WINVER
  24. // the only exception to the above is MSVC 6 which has a time bomb in its
  25. // headers: they warn against using them with WINVER >= 0x0500 as they
  26. // contain only part of the declarations and they're not always correct, so
  27. // don't define WINVER for it at all as this allows everything to work as
  28. // expected both with standard VC6 headers (which define WINVER as 0x0400
  29. // by default) and headers from a newer SDK (which may define it as 0x0500)
  30. #if !defined(__VISUALC__) || (__VISUALC__ >= 1300)
  31. #define WINVER 0x0600
  32. #endif
  33. #endif
  34. // define _WIN32_WINNT and _WIN32_IE to the highest possible values because we
  35. // always check for the version of installed DLLs at runtime anyway (see
  36. // wxGetWinVersion() and wxApp::GetComCtl32Version()) unless the user really
  37. // doesn't want to use APIs only available on later OS versions and had defined
  38. // them to (presumably lower) values
  39. #ifndef _WIN32_WINNT
  40. #define _WIN32_WINNT 0x0600
  41. #endif
  42. #ifndef _WIN32_IE
  43. #define _WIN32_IE 0x0700
  44. #endif
  45. /* Deal with clash with __WINDOWS__ include guard */
  46. #if defined(__WXWINCE__) && defined(__WINDOWS__)
  47. #undef __WINDOWS__
  48. #endif
  49. // For IPv6 support, we must include winsock2.h before winsock.h, and
  50. // windows.h include winsock.h so do it before including it
  51. #if wxUSE_IPV6
  52. #include <winsock2.h>
  53. #endif
  54. #include <windows.h>
  55. #if defined(__WXWINCE__) && !defined(__WINDOWS__)
  56. #define __WINDOWS__
  57. #endif
  58. // #undef the macros defined in winsows.h which conflict with code elsewhere
  59. #include "wx/msw/winundef.h"
  60. // Types DWORD_PTR, ULONG_PTR and so on are used for 64-bit compatibility
  61. // in the WINAPI SDK (they are an integral type that is the size of a
  62. // pointer) on MSVC 7 and later. However, they are not available in older
  63. // Platform SDKs, and since they are typedefs and not #defines we simply
  64. // overwrite them if there is a chance that they're not defined
  65. #if (!defined(_MSC_VER) || (_MSC_VER < 1300)) && !defined(__WIN64__)
  66. #define UINT_PTR unsigned int
  67. #define INT_PTR int
  68. #define HANDLE_PTR unsigned long
  69. #define LONG_PTR long
  70. #define ULONG_PTR unsigned long
  71. #define DWORD_PTR unsigned long
  72. #endif // !defined(_MSC_VER) || _MSC_VER < 1300
  73. // ----------------------------------------------------------------------------
  74. // Fix the functions wrongly implemented in unicows.dll
  75. // ----------------------------------------------------------------------------
  76. #if wxUSE_UNICODE_MSLU
  77. #if wxUSE_GUI
  78. WXDLLIMPEXP_CORE int wxMSLU_DrawStateW(WXHDC dc, WXHBRUSH br, WXFARPROC outputFunc,
  79. WXLPARAM lData, WXWPARAM wData,
  80. int x, int y, int cx, int cy,
  81. unsigned int flags);
  82. #define DrawStateW(dc, br, func, ld, wd, x, y, cx, cy, flags) \
  83. wxMSLU_DrawStateW((WXHDC)dc,(WXHBRUSH)br,(WXFARPROC)func, \
  84. ld, wd, x, y, cx, cy, flags)
  85. WXDLLIMPEXP_CORE int wxMSLU_GetOpenFileNameW(void *ofn);
  86. #define GetOpenFileNameW(ofn) wxMSLU_GetOpenFileNameW((void*)ofn)
  87. WXDLLIMPEXP_CORE int wxMSLU_GetSaveFileNameW(void *ofn);
  88. #define GetSaveFileNameW(ofn) wxMSLU_GetSaveFileNameW((void*)ofn)
  89. #endif // wxUSE_GUI
  90. #endif // wxUSE_UNICODE_MSLU
  91. #endif // _WX_WRAPWIN_H_