RegisterClass

Syntax

BOOL RegisterClass(lpWndClass)

This function registers a window class for subsequent use in calls to the CreateWindow function. The window class has the attributes defined by the contents of the data structure pointed to by the lpWndClass parameter. If two classes with the same name are registered, the second attempt fails and the information for that class is ignored.

Parameter Type/Description  

lpWndClass LPWNDCLASS Points to a WNDCLASS data structure. The structure must be filled with the appropriate class attributes before being passed to the function. See the following “Comments” section for details.  

Return Value

The return value specifies whether the window class is registered. It is nonzero if the class is registered. Otherwise, it is zero.

Comments

The callback function must use the Pascal calling conventions and must be declared FAR.

Callback Function

BOOL FAR PASCAL WndProc(hWnd, wMsg, wParam, lParam)
HWND hWnd;
WORD wMsg;
WORDwParam;
DWORDlParam;

WndProc is a placeholder for the application-supplied function name. The actual name must be exported by including it in an EXPORTS statement in the application's module-definition file.

Parameter Description  

hWnd Identifies the window that receives the message.  
wMsg Specifies the message number.  
wParam Specifies additional message-dependent information.  
lParam Specifies additional message-dependent information.  

Return Value

The window function returns the result of the message processing. The possible return values depend on the actual message sent.