|
|
|
|
|
|
|
|
|
|
|
|||||||
00001 /* 00002 * File: atlstl_window_access.h 00003 * 00004 * Purpose: Contains access shims for windows. 00005 * 00006 * Created: 10th January 2003 00007 * Updated: 11th September 2004 00008 * 00009 * Home: http://stlsoft.org/ 00010 * 00011 * Copyright (c) 2003-2004, Matthew Wilson and Synesis Software 00012 * All rights reserved. 00013 * 00014 * Redistribution and use in source and binary forms, with or without 00015 * modification, are permitted provided that the following conditions are met: 00016 * 00017 * - Redistributions of source code must retain the above copyright notice, this 00018 * list of conditions and the following disclaimer. 00019 * - Redistributions in binary form must reproduce the above copyright notice, 00020 * this list of conditions and the following disclaimer in the documentation 00021 * and/or other materials provided with the distribution. 00022 * - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of 00023 * any contributors may be used to endorse or promote products derived from 00024 * this software without specific prior written permission. 00025 * 00026 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00027 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00028 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00029 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00030 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00031 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00032 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00033 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00034 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00035 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00036 * POSSIBILITY OF SUCH DAMAGE. 00037 * 00038 * 00039 00040 00044 00045 #ifndef ATLSTL_INCL_H_ATLSTL_WINDOW_ACCESS 00046 #define ATLSTL_INCL_H_ATLSTL_WINDOW_ACCESS 00047 00048 #ifndef __STLSOFT_DOCUMENTATION_SKIP_SECTION 00049 # define ATLSTL_VER_H_ATLSTL_WINDOW_ACCESS_MAJOR 2 00050 # define ATLSTL_VER_H_ATLSTL_WINDOW_ACCESS_MINOR 0 00051 # define ATLSTL_VER_H_ATLSTL_WINDOW_ACCESS_REVISION 1 00052 # define ATLSTL_VER_H_ATLSTL_WINDOW_ACCESS_EDIT 19 00053 #endif /* !__STLSOFT_DOCUMENTATION_SKIP_SECTION */ 00054 00055 /* 00056 * Includes 00057 */ 00058 00059 #ifndef ATLSTL_INCL_H_ATLSTL 00060 # include "atlstl.h" // Include the ATLSTL root header 00061 #endif /* !ATLSTL_INCL_H_ATLSTL */ 00062 00063 #if defined(__STLSOFT_COMPILER_IS_BORLAND) 00064 # pragma warn -8013 /* Suppresses "Possible use of 'f' before definition in '. . .'" */ 00065 # pragma warn -8084 /* Suppresses "Suggest parentheses to clarify precedence in function 'f()'" */ 00066 #endif /* compiler */ 00067 00068 #include <atlwin.h> 00069 00070 #if defined(__STLSOFT_COMPILER_IS_BORLAND) 00071 # pragma warn .8013 /* Suppresses "Possible use of 'f' before definition in '. . .'" */ 00072 # pragma warn .8084 /* Suppresses "Suggest parentheses to clarify precedence in function 'f()'" */ 00073 #endif /* compiler */ 00074 00075 /* 00076 * Namespace 00077 */ 00078 00079 #ifndef _ATLSTL_NO_NAMESPACE 00080 # if defined(_STLSOFT_NO_NAMESPACE) || \ 00081 defined(__STLSOFT_DOCUMENTATION_SKIP_SECTION) 00082 /* There is no stlsoft namespace, so must define ::atlstl */ 00083 namespace atlstl 00084 { 00085 # else 00086 /* Define stlsoft::atlstl_project */ 00087 00088 namespace stlsoft 00089 { 00090 00091 namespace atlstl_project 00092 { 00093 00094 # endif /* _STLSOFT_NO_NAMESPACE */ 00095 #endif /* !_ATLSTL_NO_NAMESPACE */ 00096 00097 /* 00098 00100 00103 00107 00112 00113 /* 00114 * get_hwnd 00115 * 00116 * This can be applied to an expression, and the return value is the 00117 * corresponding HWND. 00118 */ 00119 00120 /* HWND */ 00121 00129 inline HWND get_hwnd(CWindow const &w) 00130 { 00131 return w.m_hWnd; 00132 } 00133 00135 // Unit-testing 00136 00137 #ifdef STLSOFT_UNITTEST 00138 00139 namespace unittest 00140 { 00141 ss_bool_t test_atlstl_window_access(unittest_reporter *r) 00142 { 00143 using stlsoft::unittest::unittest_initialiser; 00144 00145 ss_bool_t bSuccess = true; 00146 00147 unittest_initialiser init(r, "ATLSTL", "window_access", __FILE__); 00148 00149 HWND hwndDesktop = ::GetDesktopWindow(); 00150 CWindow wndDesktop; 00151 00152 wndDesktop.Attach(hwndDesktop); 00153 00154 if(get_hwnd(wndDesktop) != hwndDesktop) 00155 { 00156 r->report("get_hwnd(CWindow) failed ", __LINE__); 00157 bSuccess = false; 00158 } 00159 00160 wndDesktop.Detach(); 00161 00162 return bSuccess; 00163 } 00164 00165 unittest_registrar unittest_atlstl_window_access(test_atlstl_window_access); 00166 00167 } // namespace unittest 00168 00169 #endif /* STLSOFT_UNITTEST */ 00170 00172 // Implementation 00173 00174 /* 00175 00177 00178 /* 00179 00180 #ifndef _ATLSTL_NO_NAMESPACE 00181 # if defined(_STLSOFT_NO_NAMESPACE) || \ 00182 defined(__STLSOFT_DOCUMENTATION_SKIP_SECTION) 00183 } // namespace atlstl 00184 # else 00185 } // namespace atlstl_project 00186 } // namespace stlsoft 00187 # endif /* _STLSOFT_NO_NAMESPACE */ 00188 #endif /* !_ATLSTL_NO_NAMESPACE */ 00189 00190 /* 00191 00192 #endif /* ATLSTL_INCL_H_ATLSTL_SYSTEM_INFO */ 00193 00194 /*
|
|
| STLSoft Libraries documentation © Synesis Software Pty Ltd, 2001-2004 |