textRange.lpstrText = szStr; textRange.chrg.cpMin = 0; textRange.chrg.cpMax = -1; SendMessage(hWnd,EM_GETTEXTRANGE,0,(LPARAM)&textRange);