INF: Placing Text in an Edit Control

ID Number: Q32785

2.03 2.10 3.00

WINDOWS

Summary:

Text is placed into an edit control by calling SetDlgItemText() or by

sending the WM_SETTEXT message to the edit control window, with lParam

being a far pointer to a null-terminated string. This message can be

sent in two ways:

1. SendMessage(hwndEditControl, WM_SETTEXT, ...

2. SendDlgItemMessage(hwndParent, ID_EDITCTL, WM_SETTEXT...

Note: hwndParent is the window handle of the parent, which may be a

dialog or window. ID_EDITCTL is the ID of the edit control.

Text is retrieved from an edit control by calling GetDlgItemText() or

by sending the WM_GETTEXT message to the edit control window, with

wParam being the maximum number of bytes to copy and lParam being a

far pointer to a buffer to receive the text. This message can be sent

in two ways:

1. SendMessage(hwndEditControl, WM_GETTEXT, ...

2. SendDlgItemMessage(hwndParent, ID_EDITCTL, WM_GETTEXT...

Note: hwndParent is the window handle of the parent, which may be

a dialog or window. ID_EDITCTL is the ID of the edit control.