OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
wsysinc.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// Object Windows Library
3// Copyright (c) 1993, 1996 by Borland International, All Rights Reserved
4//
5// Includes windowing system headers, with necessary macros defined
6//----------------------------------------------------------------------------
7
8#if !defined(OWL_PRIVATE_WSYSINC_H)
9#define OWL_PRIVATE_WSYSINC_H
10#define SERVICES_WSYSINC_H
11
12#include <owl/private/defs.h>
13#if defined(BI_HAS_PRAGMA_ONCE)
14# pragma once
15#endif
16
17//
18// Get "windows.h" and other standard windows headers.
19//
20#if !defined(_INC_WINDOWS)
21
22//
23// We're going to pull in "windows.h".
24// Select API version, and set the header arguments we require.
25// We target Windows API version 0x0600 (Windows Vista).
26//
27#ifndef _WIN32_WINNT
28#define _WIN32_WINNT 0x0600 // _WIN32_WINNT_VISTA
29#endif
30
31#ifndef NOMINMAX
32#define NOMINMAX
33#endif
34
35#ifndef STRICT
36#define STRICT
37#endif
38
39// Omit legacy stuff from the Windows header.
40// For instance, without WIN32_LEAN_AND_MEAN, "Windows.h" will include Windows Sockets ("Winsock")
41// version 1.1, which is incompatible with version 2.
42//
43// See http://msdn.microsoft.com/en-us/library/windows/desktop/ms737629.aspx
44//
45// So to make OWLNext most broadly compatible we need to be lean here.
46//
47#define WIN32_LEAN_AND_MEAN
48
49#pragma pack(push,8)
50#include <windows.h>
51#pragma pack(pop)
52
53#else
54
55//
56// Unfortunately, "windows.h" has already been included.
57// Ensure that it was included with the required header arguments.
58// In general, let OWLNext include "windows.h".
59//
60#if !defined(STRICT) || !defined(NOMINMAX)
61#error If "windows.h" is included before OWLNext, then STRICT and NOMINMAX must be defined.
62#endif
63
64#endif
65
66//
67// Retrieve other Windows headers (before we proceed with BOOL-remapping)
68//
69
70// VER.H is currently mucking with definitions of UINT if LIB is not
71// defined.
72//
73
74// Grab shell extension header
75
76
77// Avoid mapping GetWindowLongPtr to GetWindowLong[A/W]
78#if defined(GetWindowLongPtr)
79#undef GetWindowLongPtr
80inline LONG_PTR GetWindowLongPtr(HWND hWnd, int nIndex)
81#if defined(UNICODE)
82 { return ::GetWindowLongPtrW(hWnd, nIndex); }
83# else
84 { return ::GetWindowLongPtrA(hWnd, nIndex); }
85# endif
86#endif
87
88// Avoid mapping SetWindowLongPtr to SetWindowLong[A/W]
89#if defined(SetWindowLongPtr)
90#undef SetWindowLongPtr
91inline LONG_PTR SetWindowLongPtr(HWND hWnd, int nIndex, LONG_PTR dwNewLong)
92#if defined(UNICODE)
93 { return ::SetWindowLongPtrW(hWnd, nIndex, dwNewLong); }
94# else
95 { return ::SetWindowLongPtrA(hWnd, nIndex, dwNewLong); }
96# endif
97#endif
98
99
100
101// Avoid mapping MessageBox to MessageBox[A/W]
102#if defined(MessageBox)
103#undef MessageBox
104inline int MessageBox(HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType)
105#if defined(UNICODE)
106 { return ::MessageBoxExW(hWnd, lpText, lpCaption, uType, 0); }
107# else
108 { return ::MessageBoxExA(hWnd, lpText, lpCaption, uType, 0); }
109# endif
110#endif
111
112// Avoid mapping MessageBoxIndirect to MessageBoxIndirect[A/W]
113#if defined(MessageBoxIndirect)
114#undef MessageBoxIndirect
115inline auto MessageBoxIndirect(const MSGBOXPARAMS* p) -> int
116#if defined(UNICODE)
117 { return ::MessageBoxIndirectW(p); }
118#else
119 { return ::MessageBoxIndirectA(p); }
120#endif
121#endif
122
123// Avoid mapping GetFileTitle to GetFileTitle[A/W]
124#if defined(GetFileTitle)
125#undef GetFileTitle
126inline short GetFileTitle(LPCTSTR lpszFile, LPTSTR lpszTitle, WORD cbBuf)
127#ifdef UNICODE
128 { return ::GetFileTitleW(lpszFile, lpszTitle, cbBuf); }
129#else
130 { return ::GetFileTitleA(lpszFile, lpszTitle, cbBuf); }
131#endif
132#endif
133
134// Avoid Win95 mapping DrawStatusText to DrawStatusText[A/W]
135#if defined(DrawStatusText)
136#undef DrawStatusText
137inline void DrawStatusText(HDC hDC,
138 LPRECT lprc,
140 UINT uFlags)
141#ifdef UNICODE
143#else
145#endif
146#endif
147
148// Avoid Win95 mapping DrawState to DrawState[A/W]
149#if defined(DrawState)
150#undef DrawState
151inline BOOL DrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC lpOutputFunc,
152 LPARAM lData, WPARAM wData, int x, int y, int cx, int cy, UINT fuFlags)
153#ifdef UNICODE
154 { return ::DrawStateW(hdc, hbr, lpOutputFunc, lData, wData, x, y, cx, cy, fuFlags); }
155#else
156 { return ::DrawStateA(hdc, hbr, lpOutputFunc, lData, wData, x, y, cx, cy, fuFlags); }
157#endif
158#endif
159
160#if defined(SetProp)
161#undef SetProp
162inline BOOL SetProp(HWND hWnd, LPCTSTR lpString, HANDLE hData)
163#if defined(UNICODE)
164{ return ::SetPropW(hWnd, lpString, hData); }
165# else
166{ return ::SetPropA(hWnd, lpString, hData); }
167# endif
168#endif
169
170#if defined(GetIconInfoEx)
171#undef GetIconInfoEx
172inline auto GetIconInfoEx(HICON hIcon, PICONINFOEX piconinfo) -> BOOL
173#if defined(UNICODE)
174{ return ::GetIconInfoExW(hIcon, piconinfo); }
175#else
176{ return ::GetIconInfoExA(hIcon, piconinfo); }
177#endif
178#endif
179
180#endif // OWL_PRIVATE_WSYSINC_H
181