Win32 为此使用带有参数的宏,这会破坏C++代码

Win32 uses macros with parameters for this, which breaks C++ code

本文关键字:代码 C++ 参数 Win32      更新时间:2023-10-16

我对afxv_32.h.VS 2012找不到AFX_INLINE和HTASK有问题。指定"Win32 为此使用带有参数的宏,这会破坏C++代码"。显然AFX_INLINE是一个宏。我一直在寻找它很长时间,但我没有找到它。你知道如何处理这个问题吗?

    // Win32 uses macros with parameters for this, which breaks C++ code.
    #ifdef GetWindowTask
    #undef GetWindowTask
    AFX_INLINE HTASK GetWindowTask(HWND hWnd)
        { return (HTASK)(DWORD_PTR)::GetWindowThreadProcessId(hWnd, NULL); }
    #endif
    // Win32 uses macros with parameters for this, which breaks C++ code.
    #ifdef GetNextWindow
    #undef GetNextWindow
    AFX_INLINE HWND GetNextWindow(HWND hWnd, UINT nDirection)
        { return ::GetWindow(hWnd, nDirection); }
    #endif
    // Avoid mapping CToolBar::DrawState to DrawState[A/W]
    #ifdef DrawState
    #undef DrawState
    AFX_INLINE BOOL WINAPI DrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC lpOutputFunc,
        LPARAM lData, WPARAM wData, int x, int y, int cx, int cy, UINT fuFlags)
    #ifdef UNICODE
        { return ::DrawStateW(hdc, hbr, lpOutputFunc, lData, wData, x, y, cx, cy,
            fuFlags); }
    #else
        { return ::DrawStateA(hdc, hbr, lpOutputFunc, lData, wData, x, y, cx, cy,
            fuFlags); }
    #endif
    #endif
    // Avoid mapping CStatusBar::DrawStatusText to DrawStatusText[A/W]
    #ifdef DrawStatusText
    #undef DrawStatusText
    AFX_INLINE void WINAPI AfxDrawStatusTextA(HDC hDC, LPRECT lprc, LPCTSTR szText,
        UINT uFlags);
    AFX_INLINE void WINAPI AfxDrawStatusTextW(HDC hDC, LPRECT lprc, LPCTSTR szText,
        UINT uFlags);
    AFX_INLINE void WINAPI DrawStatusText(HDC hDC, LPRECT lprc, LPCTSTR szText,
        UINT uFlags) 
    #ifdef UNICODE
        { ::AfxDrawStatusTextW(hDC, lprc, szText, uFlags); }
    #else
        { ::AfxDrawStatusTextA(hDC, lprc, szText, uFlags); }
    #endif
    #endif
    // FreeResource is not required on Win32 platforms
    #undef FreeResource
    AFX_INLINE BOOL WINAPI FreeResource(_In_ HGLOBAL) { return TRUE; }
    // UnlockResource is not required on Win32 platforms
    #undef UnlockResource
    AFX_INLINE int WINAPI UnlockResource(HGLOBAL) { return 0; }

您将在 afxisapi.h 中找到这些宏。