Monday, July 26, 2010

USES_CONVERSION.

In ATL there are some helper macros defined such as W2A() which is used to convert widechar to ansi and A2W which is used to convert ansi to WideChar. Before using this macros you should initialize the conversion by calling USES_CONVERSION. See the code snippet below.
#include "atlconv.h"
...

// Ansi string.
char* ptrStr = "Example";

// Unicode string.
wchar_t* pUStr = 0;

// Use this macro for Initializing the conversion.
// Actually, some member variable initialization deep inside.
USES_CONVERSION;

// Convert Ansi to Unicode.
pUStr = A2W( ptrStr );

// Convert Unicode to Ansi.
ptrStr = W2A( pUStr );

No comments:

Post a Comment

Health Benefits of Cashews

  Benefits of Cashews. Healthy food is an integral part of healthy body. Regular exercises such as Yoga and healthy diet is important to...