|
-
May 27th, 2001, 07:39 PM
#1
Thread Starter
Hyperactive Member
getting text from editbox
Code:
char *buf[20];
SendMessage(editbx,EM_GETLINE,0,buf);
MessageBox(NULL,buf, "Interest App", MB_OK | MB_ICONINFORMATION);
im trying to retrieve text from a editox called "editbx" and display it in a messagebox. Anyone know how to. I looked it up on MSDN and it was a bit confusing
Matt 
-
May 28th, 2001, 04:59 AM
#2
Frenzied Member
If you are using a dialogue then you can use this:
Code:
GetDlgItemText
The GetDlgItemText function retrieves the title or text associated with a control in a dialog box.
UINT GetDlgItemText(
HWND hDlg, // handle of dialog box
int nIDDlgItem, // identifier of control
LPTSTR lpString, // address of buffer for text
int nMaxCount // maximum size of string
);
Parameters
hDlg
Identifies the dialog box that contains the control.
nIDDlgItem
Specifies the identifier of the control whose title or text is to be retrieved.
lpString
Pointer to the buffer to receive the title or text.
nMaxCount
Specifies the maximum length, in characters, of the string to be copied to the buffer pointed to by lpString. If the length of the string exceeds the limit, the string is truncated.
Return Values
If the function succeeds, the return value specifies the number of characters copied to the buffer, not including the terminating null character.
If the function fails, the return value is zero. To get extended error information, callGetLastError.
Remarks
The GetDlgItemText function sends a WM_GETTEXT message to the control.
-
May 28th, 2001, 05:03 AM
#3
Frenzied Member
If not then:
Code:
long fl =SendMessage(secdlge,WM_GETTEXTLENGTH,0,0);
fl++;
TCHAR *ft = new TCHAR[fl];
SendMessage(secdlge,WM_GETTEXT,fl,(LPARAM)ft);
//ft contains text
MessageBox(NULL,ft, "Interest App", MB_OK | MB_ICONINFORMATION);
-
May 28th, 2001, 05:05 AM
#4
Monday Morning Lunatic
You can also use GetWindowText if you're using a window:
Code:
int iLen = GetWindowTextLength(hWnd_Edit);
TCHAR *pcBuf = new TCHAR[iLen + 1];
GetWindowText(hWnd_Edit, pcBuf, iLen);
// Use pcBuf
delete[] pcBuf;
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|