HP-UX SNAplus2 R7 APPC Programmer's Guide
Writing Transaction Programs
APPC Entry Points: Windows Systems
Although a verb issued to the APPC entry point appears to suspend the application until verb processing is completed,
the APPC library has to yield control of the system while waiting for SNAplus2 to complete the processing, in order
to allow other processes to run. To do this, the application uses a blocking function, which is called repeatedly while
the library is waiting; the function enables Windows messages to be sent to other processes. For more information
about this function, see Section 2.4.6,
Blocking Verbs.
It is possible for the blocking function to dispatch a message to the application that issued the original blocking verb;
in this case, the application can be re-entered even though it has a blocking call outstanding. In these circumstances,
the application can continue with other processing not related to issuing APPC verbs. However, it cannot issue
another verb to the APPC entry point (or to any other SNAplus2 API) while the first verb is outstanding; the verb
will be rejected with the primary return code
AP_THREAD_BLOCKING.
The application can check whether a blocking verb is outstanding (that is, whether it has been re-entered as a result
of a received message while the verb was outstanding) by using the WinAPPCIsBlocking function (for more
information, see Section 2.4.9, WinAPPCIsBlocking). If this function indicates that a blocking call is outstanding,
the application should not attempt to issue further APPC verbs using the blocking entry point. The application can,
however, do the following:
• Continue with other processing.
• Issue APPC verbs using the asynchronous entry point.
• Issue WinAPPCCancelBlockingCall to cancel the outstanding blocking verb.
Default Blocking Function
The standard blocking function used by the Windows APPC library is as follows:
BOOL far pascal DefaultBlockingHook (void) {
MSG msg;
/* get the next message if any */
if ( PeekMessage (&msg,NULL,0,0,PM_NOREMOVE) ) {
if ( msg.message = = WM_QUIT )
return FALSE; // let app process WM_QUIT
PeekMessage (&msg,NULL,0,0,PM_REMOVE);
TranslateMessage (&msg);
DispatchMessage (&msg);
}
/* TRUE if no WM_QUIT received */
return TRUE;
}
If the application needs to have other processing performed as part of the blocking function, it can specify its own
blocking function to replace the default one provided by APPC. To do this, it uses the WinAPPCSetBlock-
ingHook call (see Section 2.4.10, WinAPPCSetBlockingHook).
A blocking function must return
FALSE if it receives a WM_QUIT message; this means that Windows APPC returns
control to the application, which can then process the message and terminate. Otherwise, the function must return
TRUE.
2.4.7 APPC
The application uses this function to issue an APPC verb, which blocks until verb processing is completed. For
compatibility with earlier APPC implementations, SNAplus2 also provides the entry points APPC_C and APPC_P,
which can be used in the same way as APPC.
This entry point provides support for synchronous APPC verbs on Windows, which may assist in migrating from
other operating system environments.
Function Call
void WINAPI APPC (
long vcbptr
60