This example gets the text from a Dialog Box entry field as an integer value.
#define INCL_WINDIALOGS #define INCL_WINBUTTONS #include <OS2.H> #define ID_ENTRYFLD 900 #define EM_SETTEXTLIMIT 2 HAB hab; HWND hwnd; ULONG msg; switch(msg) { case WM_INITDLG: /* set entry field text limit. */ WinSendDlgItemMsg(hwnd, /* identifier of the entry field window, which is */ /* a child of the the window defined by hwnd. */ (ULONG)ID_ENTRYFLD, (ULONG)EM_SETTEXTLIMIT, /* Limit length */ /* MPFROM2SHORT macro is of the form (low 2 bytes, */ /* high 2 bytes), the the number passed is simply 2. */ MPFROM2SHORT(2,0), (MPARAM)0); /* set entry field to 12. */ WinSetDlgItemShort(hwnd, ID_ENTRYFLD, (SHORT)12,TRUE); }