HttpEventProc Function  
 
VOID CALLBACK HttpEventProc(
  HCLIENT hClient,  
  UINT nEventId,  
  DWORD dwError,  
  DWORD_PTR dwParam  
);

The HttpEventProc function is an application-defined callback function that processes events generated by the queue manager.

Parameters

hClient
Handle to the active client session while the file is being uploaded or downloaded.
nEventId
An unsigned integer which specifies which event occurred. It may be one of the following values:
Value Description
HTTP_EVENT_QUEUE This event occurs during a queued file transfer and only occurs when the internal state of the queue has changed. Unlike the other events, the handle passed to this event will be a handle to the queue, not a handle to a HTTP client session.
HTTP_EVENT_GETFILE This event occurs when a file download has completed. If multiple files are being downloaded, this event will be generated for each file.
HTTP_EVENT_PUTFILE This event occurs when a file upload has completed. If multiple files are being uploaded, this event will be generated for each file.
HTTP_EVENT_PROGRESS The client is in the process of sending or receiving a file on the data channel. This event is called periodically during a transfer so that the client can update any user interface components such as a status control or progress bar.
HTTP_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.
HTTP_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.
dwError
An unsigned integer which specifies any error that occurred. If no error occurred, then this parameter will be zero.
dwParam
A user-defined integer value which was specified when the event callback was registered.

Return Value

None.

Remarks

An application must register this callback function by passing its address to the Start method. It is used by the queue manager to notify the application when file transfers have started and completed. The HttpEventProc function is a placeholder for the application-defined function name.

When the callback function is invoked, it will execute in the context of the worker thread that is managing the queue. You must ensure that any access to global or static variables are synchronized, otherwise the results may be unpredictable. It is recommended that you do not declare any static variables within the callback function itself, and you should avoid calling any functions which could cause the thread to block. For example, you should not attempt to establish other network connections from within the event handler.

If your application has a graphical user interface, you should never attempt to directly modify a UI control from within the callback function. Controls should only be modified by the same UI thread that created their window. One common approach to resolve this issue is to post a user-defined message to the main window to signal that the user interface needs to be updated. The message handler would then process the user-defined message and update the user interface as needed.

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: cshtpv12.lib

See Also