--- mstools/mfc/include/afxnt.h 2018/08/09 18:22:45 1.1.1.2 +++ mstools/mfc/include/afxnt.h 2018/08/09 18:25:02 1.1.1.3 @@ -1,41 +1,24 @@ +// Microsoft Foundation Classes C++ library. +// Copyright (C) 1992 Microsoft Corporation, +// All rights reserved. + +// This source code is only intended as a supplement to the +// Microsoft Foundation Classes Reference and Microsoft +// QuickHelp documentation provided with the library. +// See these sources for detailed information regarding the +// Microsoft Foundation Classes product. + #ifndef WINVER #error Please do not include this file independently, #include #endif -// WM_CTLCOLOR for 16 bit API compatability +// WM_CTLCOLOR for 16 bit API compatability. #define WM_CTLCOLOR 0x0019 -////////////////////////////////////////////////////////////////////////////// -// NOTE: -// The remaining declarations and definitions will not be present in -// the final product. These are a required because of textual inconsistencies -// in the Windows NT interface files. Please ignore these. - +// We emulate HTASK for compatibility, even though Win32 has no notion of it. DECLARE_HANDLE(HTASK); -extern "C" -{ -BOOL WINAPI SubtractRect(RECT FAR*, const RECT FAR*, const RECT FAR*); -BOOL WINAPI QueryAbort(HDC, int); -} - -#undef LoadString -inline int LoadString(HINSTANCE hInstance, UINT uID, - LPSTR lpBuffer, int nBufferMax) -#ifdef UNICODE - { return ::LoadStringW(hInstance, uID, lpBuffer, nBufferMax); } -#else - { return ::LoadStringA(hInstance, uID, lpBuffer, nBufferMax); } -#endif - -#undef AnsiToOem -inline BOOL AnsiToOem(LPCSTR lpcstr, LPSTR lpstr) - { return ::CharToOemA(lpcstr, lpstr); } - -#undef OemToAnsi -inline BOOL OemToAnsi(LPCSTR lpcstr, LPSTR lpstr) - { return ::OemToCharA(lpcstr, lpstr); } - +// Windows NT uses macros to stub these out, which breaks C++ code. #undef GetSysModalWindow inline HWND GetSysModalWindow(void) { return NULL;} @@ -44,6 +27,8 @@ inline HWND GetSysModalWindow(void) inline HWND SetSysModalWindow(HWND) { return NULL; } +// Windows NT uses macros with parameters for these, which breaks C++ code. + #undef GetNextWindow inline HWND GetNextWindow(HWND hWnd, UINT uFlag) { return ::GetWindow(hWnd, uFlag); } @@ -56,26 +41,38 @@ inline int MessageBox(HWND hWnd, LPCSTR { return ::MessageBoxExA(hWnd, lpText, lpTitle, fuStyle, 0); } #endif -#undef RegQueryValue -inline LONG RegQueryValue(HKEY hKey, LPCSTR lpSubKey, - LPSTR lpValue, LONG FAR* lpcbValue ) -#ifdef UNICODE - { return ::RegQueryValueW(hKey, (LPWSTR)lpSubKey, lpValue, - (LPDWORD)lpcbValue); } -#else - { return ::RegQueryValueA(hKey, (LPSTR)lpSubKey, lpValue, - (LPDWORD)lpcbValue); } -#endif // !UNICODE - -#undef RegSetValue -inline LONG RegSetValue(HKEY hKey, LPCSTR lpSubKey, DWORD dwType, - LPCSTR lpData, DWORD cbData ) +// These are necessary because WINDOWS.H is not included consistently +// when the CString class is defined, but is included when the CString +// class is implemented. + +#undef LoadString +inline int LoadString(HINSTANCE hInstance, UINT uID, + LPSTR lpBuffer, int nBufferMax) #ifdef UNICODE - { return ::RegSetValueW(hKey, (LPWSTR)lpSubKey, dwType, - (LPSTR)lpData, cbData); } + { return ::LoadStringW(hInstance, uID, lpBuffer, nBufferMax); } #else - { return ::RegSetValueA(hKey, (LPSTR)lpSubKey, dwType, - (LPSTR)lpData, cbData); } -#endif // !UNICODE + { return ::LoadStringA(hInstance, uID, lpBuffer, nBufferMax); } +#endif + +#undef AnsiToOem +inline BOOL AnsiToOem(LPCSTR lpcstr, LPSTR lpstr) + { return ::CharToOemA(lpcstr, lpstr); } + +#undef OemToAnsi +inline BOOL OemToAnsi(LPCSTR lpcstr, LPSTR lpstr) + { return ::OemToCharA(lpcstr, lpstr); } + +////////////////////////////////////////////////////////////////////////////// +// NOTE: +// The remaining declarations and definitions will not be present in +// the final product. These are a required because of textual inconsistencies +// in the Windows NT interface files. Please ignore these. + +//REVIEW_NT: maybe someday NT will add these to their headers! + +extern "C" +{ +BOOL WINAPI SubtractRect(RECT FAR*, const RECT FAR*, const RECT FAR*); +} /////////////////////////////////////////////////////////////////////////////