This topic summarizes information about developing TPs for the Microsoft® Windows® version 3.x system.
IMPORTS WINAPPC.APPC
IMPORTS WINAPPC WinAsyncAPPC.APPC
All Windows CSV applications must call the Windows SNA extension WinCSVStartup at the beginning of the session to register the application and WinCSVCleanup to deregister the application when the session is finished.
The TP must issue the FreeLibrary call when the APPC library is no longer required.
This means that while in a blocking call, the calling application's Window procedure can be called. To test if this is the case, the extension WinAPPCIsBlocking is provided. Any attempt to make a second blocking call with one already outstanding will cause the call to fail with the return code ap_thread_blocking.
Windows APPC and CSV contain a default yield procedure for Windows version 3.x that can yield to other functions while waiting for the first function to complete. The default is:
BOOL DefaultBlockingHook (void) {
MSG msg:
/* get the next message if any */
if ( PeekMessage (&msg,0,0,PM_NOREMOVE) ) {
if ( msg.message = = WM_QUIT )
return FALSE; / / let app process WM_QUIT
PeekMessage ( &msg,0,0,PM_REMOVE) ;
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
/*TRUE if no WM_QUIT received */
return TRUE;
}
Besides the default yield procedure, Windows APPC provides WinAPPCSetBlockingHook to support applications that require more complex message processing. This call allows a Windows APPC implementation to block APPC function calls by means of a new function. It is used by Windows version 3.x applications to make blocking calls without blocking the rest of the system. To call WinAPPCSetBlockingHook:
FARPROC WINAPI WinAPPCSetBlockingHook (FARPROC 1pBlockFunc)
WinAPPCUnhookBlockingHook removes any previous blocking hook that has been installed and reinstalls the default blocking mechanism. To call WinAPPCUnhookBlockingHook:
BOOL WINAPI WinAPPCUnhookBlockingHook (void)