Defining UNICODE
In order to use the wide character (FuncNameW) versions of WinAPI functions, the macro UNICODE must be defined before including <windows.h>.
For example, the include file WinUser.h contains the following lines (edited for better readability).
WINUSERAPI int WINAPI MessageBoxA(
_In_opt_ HWND hWnd,
_In_opt_ LPCSTR lpText,
_In_opt_ LPCSTR lpCaption,
_In_ UINT uType
);
WINUSERAPI int WINAPI MessageBoxW(
_In_opt_ HWND hWnd,
_In_opt_ LPCWSTR lpText,
_In_opt_ LPCWSTR lpCaption,
_In_ UINT uType
);
#ifdef UNICODE
#define MessageBox MessageBoxW
#else
#define MessageBox MessageBoxA
#endif // !UNICODE
Here, the two WinAPI functions MessageBoxA and MessageBoxB are defined. The ansi version has LPCSTR parameters while the wide character version has LPCWSTR parameters.
Then, depending whether UNICODE is defined, the macro MessageBox either expands to MessageBoxA or MessageBoxB.
Now, when MessageBox (or any other WinAPI function that takes a string) is called, the strings should be initialized with the TEXT macro (which depending on the defined value of UNICODE) creates an ansi char* or wide character wchar_t* string.