1 #ifndef CORELIB___NCBI_OS_MSWIN__HPP
2 #define CORELIB___NCBI_OS_MSWIN__HPP
3
4 /* $Id: ncbi_os_mswin.hpp 473801 2015-07-22 17:33:35Z grichenk $
5 * ===========================================================================
6 *
7 * PUBLIC DOMAIN NOTICE
8 * National Center for Biotechnology Information
9 *
10 * This software/database is a "United States Government Work" under the
11 * terms of the United States Copyright Act. It was written as part of
12 * the author's official duties as a United States Government employee and
13 * thus cannot be copyrighted. This software/database is freely available
14 * to the public for use. The National Library of Medicine and the U.S.
15 * Government have not placed any restriction on its use or reproduction.
16 *
17 * Although all reasonable efforts have been taken to ensure the accuracy
18 * and reliability of the software and data, the NLM and the U.S.
19 * Government do not and cannot warrant the performance or results that
20 * may be obtained by using this software or data. The NLM and the U.S.
21 * Government disclaim all warranties, express or implied, including
22 * warranties of performance, merchantability or fitness for any particular
23 * purpose.
24 *
25 * Please cite the author in any work or product based on this material.
26 *
27 * ===========================================================================
28 *
29 * Author: Denis Vakatov, Vladimir Ivanov
30 *
31 */
32
33 /// @file ncbi_os_mswin.hpp
34 ///
35 /// Defines MS Windows specifics for our "C++" code.
36 /// Use this header in the place of <windows.h> to avoid various
37 /// MS-Windows "popular" preprocessor macros which screw other people's code.
38 /// This header redefines such macros with inline functions.
39 ///
40 /// For "C" code, use <corelib/impl/ncbi_os_win.h>.
41
42
43
44 #include <corelib/impl/ncbi_os_mswin.h>
45
46
47 /////////////////////////////////////////////////////////////////////////////
48 //
49 // Redefined macros
50 //
51
52 // GetObject
53 #ifdef GetObject
54 # undef GetObject
GetObject(HGDIOBJ hGdiObj,int cbBuffer,LPVOID lpvObject)55 inline int GetObject(HGDIOBJ hGdiObj, int cbBuffer, LPVOID lpvObject)
56 {
57 # ifdef _UNICODE
58 return GetObjectW(hGdiObj, cbBuffer, lpvObject);
59 # else
60 return GetObjectA(hGdiObj, cbBuffer, lpvObject);
61 # endif
62 }
63 #endif
64
65
66 #ifdef GetMessage
67 # undef GetMessage
68 inline
69 WINUSERAPI
70 BOOL
71 WINAPI
GetMessage(_Out_ LPMSG lpMsg,_In_opt_ HWND hWnd,_In_ UINT wMsgFilterMin,_In_ UINT wMsgFilterMax)72 GetMessage(
73 _Out_ LPMSG lpMsg,
74 _In_opt_ HWND hWnd,
75 _In_ UINT wMsgFilterMin,
76 _In_ UINT wMsgFilterMax)
77 {
78 # ifdef _UNICODE
79 return GetMessageW(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
80 # else
81 return GetMessageA(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
82 # endif
83 }
84 #endif
85
86
87 // DrawText
88 #ifdef DrawText
89 # undef DrawText
DrawText(HDC hDC,LPCTSTR lpString,int nCount,LPRECT lpRect,UINT uFormat)90 inline int DrawText(HDC hDC,
91 LPCTSTR lpString,
92 int nCount,
93 LPRECT lpRect,
94 UINT uFormat)
95 {
96 # ifdef _UNICODE
97 return DrawTextW(hDC, lpString, nCount, lpRect, uFormat);
98 # else
99 return DrawTextA(hDC, lpString, nCount, lpRect, uFormat);
100 # endif
101 }
102 #endif
103
104
105 // Yield
106 #ifdef Yield
107 # undef Yield
Yield(void)108 inline void Yield(void)
109 {
110 }
111 #endif
112
113
114 #endif /* CORELIB___NCBI_OS_MSWIN__HPP */
115