如题:
// _AFX_FUNCNAME definition
#ifdef UNICODE
#define _AFX_FUNCNAME(_Name) _Name##W
#else
#define _AFX_FUNCNAME(_Name) _Name##A
#endif请问下这个具体怎么用的。 功能是啥?请帮忙解释下如下CWnd中的 _AFX_FUNCNAME的用途。谢谢
#pragma push_macro("MessageBox")
#undef MessageBox
int _AFX_FUNCNAME(MessageBox)(LPCTSTR lpszText, LPCTSTR lpszCaption = NULL,
UINT nType = MB_OK);
int MessageBox(LPCTSTR lpszText, LPCTSTR lpszCaption = NULL,
UINT nType = MB_OK);
#pragma pop_macro("MessageBox")
// _AFX_FUNCNAME definition
#ifdef UNICODE
#define _AFX_FUNCNAME(_Name) _Name##W
#else
#define _AFX_FUNCNAME(_Name) _Name##A
#endif请问下这个具体怎么用的。 功能是啥?请帮忙解释下如下CWnd中的 _AFX_FUNCNAME的用途。谢谢
#pragma push_macro("MessageBox")
#undef MessageBox
int _AFX_FUNCNAME(MessageBox)(LPCTSTR lpszText, LPCTSTR lpszCaption = NULL,
UINT nType = MB_OK);
int MessageBox(LPCTSTR lpszText, LPCTSTR lpszCaption = NULL,
UINT nType = MB_OK);
#pragma pop_macro("MessageBox")
代码中写的MessageBox,通过这个宏,在Unicode下变成MessageBoxW,否则是MessageBoxA
#ifdef UNICODE
#define _AFX_FUNCNAME(_Name) _Name##W
#else
#define _AFX_FUNCNAME(_Name) _Name##A
#endif预编译期间,如果定义了宏UNICODE 宏 则 执行代码
_Name加W否则加A
具体到
int _AFX_FUNCNAME(MessageBox)(LPCTSTR lpszText, LPCTSTR lpszCaption = NULL,
UINT nType = MB_OK);
就是如果定义了宏 UNICODE
则上句变为 MessageBoxW 否则 MessageBoxA