### XxxxREGISTER

This function is used to register a private control. It is also used to provide any control-specific initialization.

Syntax

     BOOL EXPENTRY XxxxRegister (HAB hAB);

     BOOL EXPENTRY XxxxRegister (HINSTANCE hInst);

Parameters

hAB (HAB) - input

hInstance (HINSTANCE) - input

On OS/2, when the control is a UTYPE_PRIVATE, this function must register the control using the WinRegisterClass function, as follows:

    WinRegisterClass(hAB, pszClassname, XxxxWndProc,
    		 CS_CLIPSIBLINGS |
    		 CS_SYNCPAINT |
    		 CS_SIZEREDRAW,
    		 USER_CWINDOWWORDS);

On Windows, when the control is a UTYPE_PRIVATE, this function must register the control using the RegisterClassEx function, as follows:

    WNDCLASSEX wcex;                   /* Window Class Holder               */

    memset(&wcex, 0, sizeof(WNDCLASSEX));
    wcex.cbSize        = sizeof(WNDCLASSEX);
    wcex.style         = CS_GLOBALCLASS | CS_PARENTDC | CS_HREDRAW | CS_VREDRAW;
    wcex.lpfnWndProc   = XxxxWndProc;
    wcex.hInstance     = hInst;
    wcex.lpszClassName = pszClassname;
    wcex.cbWndExtra    = USER_CWINDOWWORDS;
    wcex.hCursor       = LoadCursor(NULL, IDC_ARROW);

                           /* Register the control class with Windows NT    */
                           /* return registration result                    */

    if ( !RegisterClassEx(&wcex) )
       {
       if ( GetLastError( ) == ERROR_CLASS_ALREADY_EXISTS )
           UnregisterClass(wcex.lpszClassName, hInst);

       return(RegisterClassEx(&wcex));
       }
    else
       return(TRUE);

Additional memory can be reserved for the control by adding the required value to the USER_CWINDOWWORDS constant. Additional class styles can also be defined for the control. The pszClassname parameter must contain the class name of the control and be consistent with the value placed in the USERINFO structure element szClassname parameter in the XxxxQuery function. The control can use other style flags as appropriate.

Returns

rc (BOOL) - returns

A returned value of FALSE indicates that The control could not be registered and should not be used. A flag indicating successful completion.

TRUE | Successful registration of the control
FALSE | The control could not be registered and should not be used.

Control Extensions

PMCX Construction

PMCX Architecture
How PMCX Works