OWLNext 7.0
Borland's Object Windows Library for the modern age
|
Almost all dialog boxes have, as child windows, controls such as edit controls, list boxes, buttons, and so on.
Those controls are created from the dialog box resource.
There is a two-way communication between a dialog box object and its controls. In one direction, the dialog box needs to manipulate its controls; for example, to fill a list box. In the other direction, it needs to process and respond to the messages the controls generate; for example, when the user selects an item from a list box.
Wndows defines a set of control messages that are sent from the application back to Windows. For example, list-box messages include LB_GETTEXT, LB_GETCURSEL, and LB_ADDSTRING.
It is rarely necessary to use control messages to communicate with controls: ObjectWindows control classes provide member functions to perform the same actions. The purpose of discussing these communication mechanisms is simply to enhance your understanding of the process.
Control messages specify the specific control and pass along information in wParam and lParam arguments. Each control in a dialog resource has an identifier that you use to specify the control that receives the message. To send a control message, you can call SendDlgItemMessage. For example, the following member function adds the specified string to the list box using the LB_ADDSTRING message: