The RpcWinSetYieldInfo function configures Microsoft Windows 3.x client applications to yield to other applications during remote procedure calls.
Note This function is only available for 16-bit Windows client applications. A 32-bit application should take advantage of the preemptive multitasking and multithreading support that the 32-bit Windows operating systems provide.
#include <rpc.h>
RPC_STATUS
RpcWinSetYieldInfo(
HWND hWnd,
BOOL fCustomYield,
WORD wMsg,
DWORD dwOtherInfo
);
Standard yield applications receive messages for both the start and end of the yield period. Custom yield applications receive messages that indicate when the RPC operation has completed.
Value | Yield method |
---|---|
TRUE | Custom yield |
FALSE | Standard yield |
For standard-yield applications, the message indicates the beginning or end of the yield period. This allows the application to refrain from performing operations that are illegal during an RPC operation. Standard-yield applications use the following values of wParam and lParam with this message:
Parameter | Value | Description |
---|---|---|
wParam | 1 | Yield period beginning |
wParam | 0 | Yield period ending |
lParam | – | Unused |
For a custom-yield application, the wMsg message notifies the application that the RPC operation is complete. When the application receives this message, it should immediately return control to the RPC run-time library by having the callback function return. The values of wParam and lParam are set to zero and are not used.
For standard-yield applications, dwOtherInfo contains an optional HANDLE to an application-supplied dialog-box resource. This handle is passed as the second parameter to the DialogBoxIndirect function. If the handle specified by dwOtherInfo is zero, the default dialog box supplied by the RPC run-time library is used. For more informatin about DialogBoxIndirect, see your Windows API reference documentation.
For custom-yield applications, dwOtherInfo contains the procedure-instance address of the application-supplied callback function.
The RpcWinSetYieldInfo function supports two yielding methods:
When a conventional RPC client application makes a remote procedure call, the MIDL-generated stub calls the RPC run-time library and the library calls the appropriate transport. These calls are synchronous and block until the server side sends back a response. In the cooperatively multitasked Windows 3.x environment, an active, blocked application prevents Windows and other Windows applications from running. The RpcWinSetYieldInfo function allows you to direct the application to yield to Windows and other Windows applications while waiting for an RPC operation to finish.
Windows RPC client applications can be organized into three classes that correspond to levels of yielding support: no yielding, standard yielding, and custom yielding.
You can replace the provided dialog-box resource with an application-specified dialog-box resource. The resource must use the same style as the default and must contain a single push-button control with an IDCANCEL ID. The dialog-box function is part of the RPC run-time library and cannot be replaced.
To yield in a well-behaved manner from within the context of a pending RPC operation, applications must observe the following rules:
There is no guarantee that any code that supports yielding will be invoked. Whether or not an application yields depends on the specific call, the current state of the underlying system, and the implementation of the underlying RPC transport. Applications should not rely on this code to do anything other than manage yielding.
The RpcWinSetYieldInfo function can be called more than once by an application. Each call simply replaces the information stored in the previous calls.
Value | Meaning |
---|---|
RPC_S_OK | The information was set successfully. |
RPC_S_OUT_OF_MEMORY | Memory could not be allocated to store the information for this task. |
Windows CE: Unsupported.
Import Library: Link with rpcrt4.lib.
DefWindowProc, DialogBoxIndirect, MakeProcInstance, YieldFunctionName