I think you are confusing the concept of a header file's "include guard" with Windows API's macros used for generic function prototypes involving text arguments. The two are entirely different types of macros.
The first is this:
1 2 3 4 5 6 7 8
|
//inside myheader.h
#ifndef MYHEADER_H
#define MYHEADER_H
// ... (content of header file goes here)
#endif
|
This is a technique often used to make sure the header isn't included more than once, and is in no way specific to the Windows API. If MYHEADER_H is already defined, the content of the header is skipped due to the preprocessor returning false during the
#ifndef
test, and moving all the way to the
#endif
, which coincides with the end of the header file's content (thus avoiding the double declaration of the content by skipping the content altogether). If it isn't already defined, this implies that this is the first inclusion of this header file, so we define MYHEADER_H (thus preventing any future double inclusions), and the content of the header follows and is parsed.
"MYHEADER_H" is simply chosen because it reflects the name of the header file the include guard belongs to. Another name could be used in it's place, but it would create confusion and would potentially inhibit the include guard's functionality. Another approach you might see, again based on the header file's name, is "_MYHEADER_H_", etc. .
Now, on the other hand, The macros referred to regarding generic function prototypes are like this:
1 2 3 4 5 6 7
|
//inside the body of a Windows API header file (and after the include guard for that file)
#ifdef UNICODE
#define SetWindowText SetWindowTextW
#else
#define SetWindowText SetWindowTextA
#endif // !UNICODE
|
This is a macro that determines the definition of SetWindowText() based on whether UNICODE is defined. If it is, SetWindowText() is defined as SetWindowTextW(), and takes Unicode text arguments. If not, it is defined as SetWindowTextA(), and takes ANSI text arguments. The functionality of this is that the generic prototype takes generic data types of type LPCTSTR as arguments, which
also have similar macros:
1 2 3 4 5
|
#ifdef UNICODE
typedef LPCWSTR LPCTSTR;
#else
typedef LPCSTR LPCTSTR;
#endif
|
So that, again based on UNICODE being defined, the generic LPCTSTR becomes either LPCWSTR (pointer to a constant null-terminated string of Unicode characters) or LPCSTR (pointer to a constant null-terminated string of ANSI characters).
So, the two are entirely different concepts. Hopefully this clarified them a bit for you.