WhoisEnableEvents Function  
 
INT WINAPI WhoisEnableEvents(
  HCLIENT hClient,  
  HWND hEventWnd,  
  UINT uEventMsg  
);

The WhoisEnableEvents function enables event notifications using Windows messages.

This function has been deprecated and may be unavailable in future releases. It was designed for use in legacy single-threaded applications and requires the application to have a message pump to process event messages. It should not be used with applications which are designed to execute as a service or those which do not have a graphical user interface.

Applications should use the WhoisRegisterEvent function to register an event handler which is invoked when an event occurs.

Parameters

hClient
Handle to the client session.
hEventWnd
Handle to the event notification window. This window receives a user-defined message which specifies the event that has occurred. If this value is NULL, event notification is disabled.
uEventMsg
An unsigned integer which specifies the user-defined message that is sent when an event occurs. This parameter's value must be greater than the value of WM_USER.

Return Value

If the function succeeds, the return value is zero. If the function fails, the return value is WHOIS_ERROR. To get extended error information, call WhoisGetLastError.

Remarks

When a message is posted to the notification window, the low word of the lParam parameter contains the event identifier. The high word of lParam contains the low word of the error code, if an error has occurred. The wParam parameter contains the client handle. One or more of the following event identifiers may be sent:

Value Description
WHOIS_EVENT_CONNECT The connection to the server has completed. The high word of the lParam parameter should be checked, since this notification message will be posted if an error has occurred.
WHOIS_EVENT_DISCONNECT The server has closed the connection to the client. The client should read any remaining data and disconnect.
WHOIS_EVENT_READ Data is available to read by the calling process. No additional messages will be posted until the client has read at least some of the data. This event is only generated if the client is in asynchronous mode.
WHOIS_EVENT_WRITE The client can now write data. This notification is sent after a connection has been established, or after a previous attempt to write data has failed because it would result in a blocking operation. This event is only generated if the client is in asynchronous mode.
WHOIS_EVENT_TIMEOUT The network operation has exceeded the specified timeout period. The client application may attempt to retry the operation, or may disconnect from the server and report an error to the user.
WHOIS_EVENT_CANCEL The current operation has been canceled. Under most circumstances the client should disconnect from the server and re-connect if needed. After an operation has been canceled, the server may abort the connection or refuse to accept further commands from the client.

To cancel asynchronous notification and return the client to a blocking mode, use the WhoisDisableEvents function.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: cswhov12.lib

See Also