Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
4/14/2010

You can create an expandable edit control for Windows Mobile Standard by using the Windows Embedded CE CreateWindowand Windows Embedded CE SendMessagefunctions.

To create an expandable edit control
  1. Add the CreateWindowfunction to create the edit control. Specify the control ID using the HMENUparameter and the ES_AUTOHSCROLL, ES_AUTOVSCROLL, and ES_MULTILINEstyles. For information about the styles, see Expandable Edit Control.

    In the following example, the HMENUparameter specifies nEditID:

    Copy Code
    hwndList = CreateWindow(TEXT("ExpandableEdit"), NULL, 
    						WS_VISIBLE|  | 
    						 | , 
    						x, y, cx, cy,
    						hwndParent, (), hinst, NULL);
    
  2. Add the CreateWindowfunction to create the up-down control. You can add styles to modify the control. For more information, see Expandable Edit Control.

    In the following example, the UDS_EXPANDABLEstyle is added to expand the control to a full screen when the user presses the Action key:

    Copy Code
    hwndUpDown = CreateWindow(UPDOWN_CLASS, NULL, 
    						WS_VISIBLE | UDS_ALIGNRIGHT | 
    						 | UDS_NOSCROLL, 
    						0, 0, 0, 0, 
    						hwndParent, (HMENU)nUpDownID, hinst, 
    						NULL);
    
  3. Add the SendMessagefunction to send a message to the up-down control. The message specifies the ID of the edit control and sets this control as the buddy window for the up-down control.

    In the parameter list, specify the up-down and edit control handles and the Windows Embedded CE UDM_SETBUDDYmessage. In the following example, the handles are hwndUpDownand hwndEdit:

    SendMessage(hwndUpDown, UDM_SETBUDDY, (WPARAM)hwndEdit, 0);

Code Example

The following code example demonstrates how to create an expandable edit control.

Note:
To make the following code example easier to read, security checking and error handling are not included. This code example should not be used in a release configuration unless it has been modified to include them.
Copy Code
BOOL rb;
int rc;
LRESULT lr;

hwndList = CreateWindow(TEXT("ExpandableEdit"), NULL, 
						WS_VISIBLE| ES_AUTOHSCROLL | 
						ES_AUTOVSCROLL | ES_MULTILINE, 
						x, y, cx, cy,
						hwndParent, (HMENU)nEditID, hinst, NULL);
if (hwndList == NULL)  // CreateWindow failed.
{
	rc = MessageBox(NULL, _T("Could not create list box window."),
					_T("Error"), MB_OK);
	if (rc == 0)  // Not enough memory to create MessageBox.
		return E_OUTOFMEMORY;
	return E_FAIL;  // Replace with specific error handling.
}

hwndUpDown = CreateWindow(UPDOWN_CLASS, NULL, 
						WS_VISIBLE | UDS_ALIGNRIGHT | 
						UDS_EXPANDABLE | UDS_NOSCROLL, 
						0, 0, 0, 0, 
						hwndParent, (HMENU)nUpDownID, hinst,
NULL);
if (hwndUpDown == NULL)  // CreateWindow failed.
{
	rc = MessageBox(NULL, _T("Could not create Up/Down window."),
					_T("Error"), MB_OK);
	if (rc == 0)  // Not enough memory to create MessageBox.
		return E_OUTOFMEMORY;
	return E_FAIL;  // Replace with specific error handling.
}

lr = SendMessage(hwndUpDown, UDM_SETBUDDY, (WPARAM)hwndEdit, 0);
// lr now contains the handle to the previous buddy window.

See Also