Try this:
PHP Code:
int len = GetWindowTextLength(GetDlgItem(dlghwnd, EDIT1));
char* buf;
buf = (char*)GlobalAlloc(GPTR, len + 1);
GetDlgItemText(dlghwnd, EDIT1, buf, len + 1);
MessageBox(NULL,buf,"EDIT1 Text", MB_OK);
GlobalFree((HANDLE)buf);
That will work if you are using EDIT1 on a dialog box. If it's on a standard window and you know its handle, you can use the following code:
PHP Code:
int len = GetWindowTextLength(edit1hwnd);
char* buf;
buf = (char*)GlobalAlloc(GPTR, len + 1);
GetWindowText(wndhwnd, buf, len + 1);
MessageBox(NULL,buf,"EDIT1 Text", MB_OK);
GlobalFree((HANDLE)buf);