INFO: Compiler Errors with Win32 APIs Ending in "A" or "W"Last reviewed: October 3, 1997Article ID: Q119331 |
The information in this article applies to:
SUMMARYWhen the names of Win32 APIs appear in compiler error messages, they may have either an "A" or a "W" appended to the API name. For example, the API CreateProcess() can appear as "CreateProcessA" in an error message such as the following:
error C2664: 'CreateProcessA' : cannot convert parameter 9The reason for this is that many Win32 APIs have both a ANSI ("A") and a Unicode ("W") version. The Windows NT header files use macros such as the following to select the appropriate API:
#ifdef UNICODE #define CreateProcess CreateProcessW #else #define CreateProcess CreateProcessA #endif // !UNICODE MORE INFORMATIONThe Windows NT header files also contain more complicated macros, which use hidden arguments:
#define CreateWindowA(lpClassName, lpWindowName, dwStyle, x, y,\ nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)\ CreateWindowExA(0L, lpClassName, lpWindowName, dwStyle, x, y,\ nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam) #define CreateWindowW(lpClassName, lpWindowName, dwStyle, x, y,\ nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)\ CreateWindowExW(0L, lpClassName, lpWindowName, dwStyle, x, y,\ nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam) #ifdef UNICODE #define CreateWindow CreateWindowW #else #define CreateWindow CreateWindowA #endif // !UNICODEIn this case, an error message may refer to argument 8 on a line of your code, but the argument is really argument 7 in your source code. Other error messages that may have unexpected diagnostic information because of macro expansion include the following:
|
Additional query words: 8.00 9.00 9.10 10.00 10.10
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |