You can create a spin box control for a Windows Mobile-based Smartphone by using the Windows CE CreateWindow and Windows CE SendMessage functions.
BOOL rb;
int rc;
LRESULT lr;
hwndList = CreateWindow(TEXT("ListBox"), NULL,
WS_VISIBLE | LBS_NOINTEGRALHEIGHT,
x, y, cx, cy,
hwndParent, (HMENU)nListID, 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(TEXT("UpDownClass"), NULL,
WS_VISIBLE | UDS_HORZ |UDS_ALIGNRIGHT |
UDS_ARROWKEYS | UDS_SETBUDDYINT |
UDS_WRAP | UDS_EXPANDABLE,
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)hwndList, 0);
// lr now contains the handle to the previous buddy window.