#include
CString sCaption;
GetWindowText(sCaption); // get label text
wchar_t* szCap=NULL; // char buffer
int iLen=sCaption.GetLength(); // buffer size
szCap=(wchar_t*)malloc(4+2*iLen); // allocate buffer
if (szCap==NULL) return; // allocation failure
wcscpy(szCap,sCaption); // copy text to buffer
szCap[iLen]=' '; // ensure the last char is a space
szCap[1+iLen]='\0';
wchar_t* tokenpos;