WinHLLAPISetBlockingHook

Top  Previous  Next

This function sets an application-defined procedure to be executed while waiting for the completion of a blocking call. A blocking call is any synchronous function that takes a long time to execute and does not return until complete. There are five blocking calls in this implementation of WinHLLAPI. The blocking calls are: Get Key (51), Wait (4), Pause (18), Send File (90), and Receive File (91).

 

 

Syntax

 

FARPROC WinHLLAPISetBlockingHook(FARPROC lpfnBlockingHook)

 

 

Parameters

 

lpfnBlockingHook

 

This is a pointer to the new blocking procedure.

 

 

Description

 

The WinHLLAPI implementation has a default blocking procedure that consists of nothing more than a message handler. This default mechanism is shown in the following example:

 

BOOL    DefaultBlockingHook

{

     MSG msg;

 

     if (PeekMessage (&msg, NULL, 0, 0, xfPM_NOREMOVE))

     {

           if(msg.message = = WM_QUIT)

           {

               return FALSE;

           }

           PeekMessage (&msg, NULL, 0, 0, PM_REMOVE);

           TranslateMessage (&msg);

           DispatchMessage (&msg);

     }

return TRUE;

}

 

The blocking hook is implemented on a per-thread basis. A blocking hook set by this function will stay in effect for the thread until it is replaced by another call to WinHLLAPISetBlockingHook() or until the default is restored by a call to WinHLLAPIUnhookBlockingHook().

 

The Blocking function must return FALSE if it receives a WM_QUIT message so WinHLLAPI can return control to the application to process the message and terminate gracefully. Otherwise, the function should return TRUE.

 

 

Returns

 

This function returns a pointer to the blocking function being replaced.