You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

151 lines
5.3 KiB

  1. /* /////////////////////////////////////////////////////////////////////////
  2. * File: atlstl/shims/attribute/get_HWND.hpp
  3. *
  4. * Purpose: Contains access shims for windows.
  5. *
  6. * Created: 10th January 2003
  7. * Updated: 10th August 2009
  8. *
  9. * Home: http://stlsoft.org/
  10. *
  11. * Copyright (c) 2003-2009, Matthew Wilson and Synesis Software
  12. * All rights reserved.
  13. *
  14. * Redistribution and use in source and binary forms, with or without
  15. * modification, are permitted provided that the following conditions are met:
  16. *
  17. * - Redistributions of source code must retain the above copyright notice, this
  18. * list of conditions and the following disclaimer.
  19. * - Redistributions in binary form must reproduce the above copyright notice,
  20. * this list of conditions and the following disclaimer in the documentation
  21. * and/or other materials provided with the distribution.
  22. * - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of
  23. * any contributors may be used to endorse or promote products derived from
  24. * this software without specific prior written permission.
  25. *
  26. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  27. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  29. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  30. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  31. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  32. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  33. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  34. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  35. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  36. * POSSIBILITY OF SUCH DAMAGE.
  37. *
  38. * ////////////////////////////////////////////////////////////////////// */
  39. /** \file atlstl/shims/attribute/get_HWND.hpp
  40. *
  41. * \brief [C++ only] Definition of stlsoft::get_HWND attribute shim
  42. * functions for ATL types
  43. * (\ref group__library__shims__window_attribute "Window Attribute Shims").
  44. */
  45. #ifndef ATLSTL_INCL_SHIMS_ATTRIBUTE_HPP_GET_HWND
  46. #define ATLSTL_INCL_SHIMS_ATTRIBUTE_HPP_GET_HWND
  47. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  48. # define ATLSTL_VER_SHIMS_ATTRIBUTE_HPP_GET_HWND_MAJOR 4
  49. # define ATLSTL_VER_SHIMS_ATTRIBUTE_HPP_GET_HWND_MINOR 1
  50. # define ATLSTL_VER_SHIMS_ATTRIBUTE_HPP_GET_HWND_REVISION 1
  51. # define ATLSTL_VER_SHIMS_ATTRIBUTE_HPP_GET_HWND_EDIT 43
  52. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  53. /* /////////////////////////////////////////////////////////////////////////
  54. * Includes
  55. */
  56. #ifndef ATLSTL_INCL_ATLSTL_HPP_ATLSTL
  57. # include <atlstl/atlstl.hpp>
  58. #endif /* !ATLSTL_INCL_ATLSTL_HPP_ATLSTL */
  59. #if defined(STLSOFT_COMPILER_IS_BORLAND)
  60. # pragma warn -8013 /* Suppresses "Possible use of 'f' before definition in '. . .'" */
  61. # pragma warn -8084 /* Suppresses "Suggest parentheses to clarify precedence in function 'f()'" */
  62. #endif /* compiler */
  63. #ifndef STLSOFT_INCL_SYS_H_ATLWIN
  64. # define STLSOFT_INCL_SYS_H_ATLWIN
  65. # include <atlwin.h>
  66. #endif /* !STLSOFT_INCL_SYS_H_ATLWIN */
  67. #if defined(STLSOFT_COMPILER_IS_BORLAND)
  68. # pragma warn .8013 /* Suppresses "Possible use of 'f' before definition in '. . .'" */
  69. # pragma warn .8084 /* Suppresses "Suggest parentheses to clarify precedence in function 'f()'" */
  70. #endif /* compiler */
  71. /* /////////////////////////////////////////////////////////////////////////
  72. * Namespace
  73. */
  74. #ifndef _ATLSTL_NO_NAMESPACE
  75. # if defined(_STLSOFT_NO_NAMESPACE) || \
  76. defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  77. /* There is no stlsoft namespace, so must define ::atlstl */
  78. namespace atlstl
  79. {
  80. # else
  81. /* Define stlsoft::atlstl_project */
  82. namespace stlsoft
  83. {
  84. namespace atlstl_project
  85. {
  86. # endif /* _STLSOFT_NO_NAMESPACE */
  87. #endif /* !_ATLSTL_NO_NAMESPACE */
  88. /* /////////////////////////////////////////////////////////////////////////
  89. * get_HWND
  90. *
  91. * This can be applied to an expression, and the return value is the
  92. * corresponding HWND.
  93. */
  94. /* HWND */
  95. /** \brief Access the HWND of the given CWindow instance
  96. *
  97. * \ingroup group__library__shims__window_attribute
  98. *
  99. * This access <a href = "http://stlsoft.org/white_papers.html#shims">shim</a> retrieves the
  100. * HWND window handle for the given CWindow instance.
  101. *
  102. * \param w A reference to the CWindow instance whose HWND will be retrieved
  103. * \return The HWND corresponding to the given CWindow instance \c w
  104. *
  105. */
  106. inline HWND get_HWND(CWindow const& w)
  107. {
  108. return w.m_hWnd;
  109. }
  110. ////////////////////////////////////////////////////////////////////////////
  111. // Unit-testing
  112. #ifdef STLSOFT_UNITTEST
  113. # include "./unittest/get_HWND_unittest_.h"
  114. #endif /* STLSOFT_UNITTEST */
  115. /* ////////////////////////////////////////////////////////////////////// */
  116. #ifndef _ATLSTL_NO_NAMESPACE
  117. # if defined(_STLSOFT_NO_NAMESPACE) || \
  118. defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  119. } // namespace atlstl
  120. # else
  121. } // namespace atlstl_project
  122. } // namespace stlsoft
  123. # endif /* _STLSOFT_NO_NAMESPACE */
  124. #endif /* !_ATLSTL_NO_NAMESPACE */
  125. /* ////////////////////////////////////////////////////////////////////// */
  126. #endif /* ATLSTL_INCL_SHIMS_ATTRIBUTE_HPP_GET_HWND */
  127. /* ///////////////////////////// end of file //////////////////////////// */