[comp.windows.ms.programmer] Formatted CONTROLs

DOUG.CONMY@OFFICE.WANG.COM (Doug Conmy) (12/15/90)

>Does anyone have a formatted edit control that I could examine?  I want to
>create a control that will use COBOL PICture format specifications to make
>data entry more informative for the user of my application, but I'm not quite
>sure how to implement the control.  I've considered creating a window and
>processing all the messages that would be required (... a lot of work...) or
>creating an edit control and modifying it's processing of user input...

One possible method of doing the above is to create a new window class
which has the procedure below with style CS
The procedure below is called whenever a control based on the class gets
messages.  You can perform any special processing for the control (restrict
input to numbers only in the example below) and send the remaining messages
to the standard edit procedure.  It may be desired that some additional
data is allocated for the class structure and the pointer to the edit
routine be stored in the class data.  This will eliminate the need
for each instance of the class to look up the function pointer.  However,
I am not sure it is possible to place information in the additional class
data area until you have a handle of an instance.  Any ideas???

long FAR PASCAL NumWndProc(HWND hWnd, WORD msg, WORD wParam, LONG lParam)
[
static (FAR PASCAL *lpEditWndProc)();

    switch (msg)
        [
        case WM
            GetClassInfo(NULL, "edit", &WndClass);
            lpEditWndProc = WndClass.lpfnWndProc;
            break;
        case WM
            if (!isdigit(wParam) && isprint(wParam))
                [
                MessageBeep(0);
                return(FALSE);
                ]
            break;
         ]
    return (CallWindowProc(lpEditWndProc, hWnd, msg, wParam, lParam));
]

I hope this helps.

DOUG.CONMY@OFFICE.WANG.COM