// Similarity int simLength = GetWindowTextLength(GetDlgItem(hWnd, IDC_CONVSIM)); if (simLength > 0) { wchar_t * simBuf; simBuf = (wchar_t*)GlobalAlloc(GPTR, simLength + 1); GetDlgItemText(hWnd, IDC_CONVSIM, simBuf, simLength + 1); GlobalFree((HANDLE)simBuf); }