Bon, pour avoir une explication de ce qui se passe allez voir ici.
- http://www.codeproject.com/Articles/...-I-Win32-Chara
- http://www.codeproject.com/Articles/...-II-String-Wra
Allez voir plus spécifiquement la section MBCS and Unicode in the Win32 API et TCHAR to the rescue! dans la première page.
Je me permet de reproduire le texte en anglais.
...
. So how is it that we can write "SetWindowText" when there isn't an API by that name? The winuser.h header file contains some #defines, like this:
1 2 3 4 5 6 7 8 9
|
BOOL WINAPI SetWindowTextA ( HWND hWnd, LPCSTR lpString );
BOOL WINAPI SetWindowTextW ( HWND hWnd, LPCWSTR lpString );
#ifdef UNICODE
#define SetWindowText SetWindowTextW
#else
#define SetWindowText SetWindowTextA
#endif |
When building for the MBCS APIs, UNICODE is not defined, so the preprocessor sees:
#define SetWindowText SetWindowTextA
and replaces calls to SetWindowText() with calls to the real API, SetWindowTextA(). (Note that you can, if you wanted to, call SetWindowTextA() or SetWindowTextW() directly, although you'd rarely need to do that.)
Voir aussi les pages sur MSDN- http://msdn.microsoft.com/en-us/library/c426s321
- http://msdn.microsoft.com/en-us/library/tsbaswba
Beaucoup de temps perdu à déboguer va être sauvé dorénavant.
Partager