I have the following code
Code:HWND DialogBoxH; //Get the info on the Edit Box int len = GetWindowTextLength(DialogBoxH=GetDlgItem(hwnd, IDC_EDIT2));//Use GetDlgItem(hwnd, IDC_TEXT) //to get a handle to the //Edit Box if(len > 0)//if it's more than zero, meaning it has characters { char* buf; buf = (char*)GlobalAlloc(GPTR, len + 1);//we add one here for the null GetDlgItemText(hwnd, IDC_EDIT2, buf, len + 1);//get the text from the edit box memcpy(Cliente.ClientName,buf, sizeof buf); //copy the text from buf to the struct MessageBox (DialogBoxH, Cliente.ClientName,"Something", MB_OK); //... do stuff with text ... GlobalFree((HANDLE)buf); }
Why is it that MessageBox doens't print out the whole thing I type on the Edit Box, but only about the first 4 characters.....anyone?



LinkBack URL
About LinkBacks


