Waitrud Weber’s blog

things and reminders for memories

3d: Step forward Visual Studio: Good System: WinUser.h

(20201212: Visual studio)

In WinUser.h "DrawText" is defined like the below.
If we use "DrawText" as normal, the function of "DrawTextW" is selected, which means not ascii but UNICODE selected.


"WinUser.h"

WINUSERAPI
_Success_(return)
int
WINAPI
DrawTextA(
    _In_ HDC hdc,
    _When_((format & DT_MODIFYSTRING), _At_((LPSTR)lpchText, _Inout_grows_updates_bypassable_or_z_(cchText, 4)))
    _When_((!(format & DT_MODIFYSTRING)), _In_bypassable_reads_or_z_(cchText))
    LPCSTR lpchText,
    _In_ int cchText,
    _Inout_ LPRECT lprc,
    _In_ UINT format);
WINUSERAPI
_Success_(return)
int
WINAPI
DrawTextW(
    _In_ HDC hdc,
    _When_((format & DT_MODIFYSTRING), _At_((LPWSTR)lpchText, _Inout_grows_updates_bypassable_or_z_(cchText, 4)))
    _When_((!(format & DT_MODIFYSTRING)), _In_bypassable_reads_or_z_(cchText))
    LPCWSTR lpchText,
    _In_ int cchText,
    _Inout_ LPRECT lprc,
    _In_ UINT format);
#ifdef UNICODE
#define DrawText  DrawTextW
#else
#define DrawText  DrawTextA
#endif // !UNICODE