4.20 WFSRegister

HRESULT WFSRegister( hService, dwEventClass, hWndReg )

Enables event monitoring for the specified service by the specified window; all messages of the specified class(es) are sent to the window specified in the hWndReg parameter. The synchronous version of WFSAsyncRegister.

Parameters HSERVICE hService

Handle to the service provider as returned by WFSOpen or WFSAsyncOpen. If this value is NULL, and dwEventClass is SYSTEM_EVENTS, the XFS manager registers the application for those system events generated by the Manager itself.

DWORD dwEventClass

The class(es) of events for which the application is registering. Specified as a set of bit masks that are logically ORed together into this parameter.

HWND hWndReg

The window handle which is to be registered to receive the specified messages.

Mode Synchronous

Comments Issuing a WFSRegister for a service enables event monitoring on that service. WFSRegister calls can be cumulative for the same window. For example, to receive notification for both system and user events, the application can call WFSRegister with both SYSTEM_EVENTS and USER_EVENTS, as follows:

hr = WFSRegister(hPassbook1, SYSTEM_EVENTS | USER_EVENTS, hWndReg1);

or call them in two phases:

 hr = WFSRegister( hPassbook1, SYSTEM_EVENTS, hWndReg1);
 . . . . . . . . 
 . . . . . . . . 

hr = WFSRegister( hPassbook1, USER_EVENTS, hWndReg1);

To cancel notifications use WFSDeregister.

Note that the service provider always monitors the service, regardless of whether an application has registered for event monitoring. Issuing WFSRegister simply causes the service provider to post messages to the application in addition to handling the messages itself. See the discussion in Section 3.11.

Error Codes If the function return is not WFS_SUCCESS, it is one of the following error conditions.

WFS_ERR_CANCELED
The request was canceled by WFSCancelBlockingCall.
WFS_ERR_CONNECTION_LOST
The connection to the service is lost.
WFS_ERR_INTERNAL_ERROR
An internal inconsistency or other unexpected error occurred in the WOSA/XFS subsystem.
WFS_ERR_INVALID_EVENT_CLASS
The dwEventClass parameter specifies one or more event classes not supported by the service.
WFS_ERR_INVALID_HSERVICE
The hService parameter is not a valid service handle.
WFS_ERR_INVALID_HWNDREG
The hWndReg parameter is not a valid window handle.
WFS_ERR_NOT_STARTED
The application has not previously performed a successful WFSStartUp.
WFS_ERR_OP_IN_PROGRESS
A blocking operation is in progress on the thread; only WFSCancelBlockingCall and WFSIsBlocking are permitted at this time.

See also WFSAsyncRegister, WFSDeregister, WFSAsyncDeregister