Sample program
In order for the BlueZone Host Automation Object to communicate with a BlueZone display emulation session, you must enable the BlueZone DDE interface.
Refer to Configuring BlueZone for more information.
The following example shows how to incorporate the BlueZone Host Automation Object into a custom C/C++ application:
// add BZWhll_i.c to the project as a source file
#include "BZWhll.h"
IWhllObj *pHost = NULL; // pointer to BHAO
// before using BHAO make sure COM is available and initialized
HRESULT hr = CoInitialize( NULL );
if ( FAILED(hr) )
     return 0;
// create an instance of the BHAO object
hr = CoCreateInstance(  
               CLSID_WhllObj, 
               NULL, 
               CLSCTX_INPROC_SERVER,
               IID_IWhllObj,
               (void **)&pHost );
if ( SUCCEEDED(hr) )
{
     // pHost can now be used to access the host system.
     // For purposes of this example, we will just login and logoff
     // of a zSeries system.
     int nRetval; // method return code
     char Buf[ 2048 ]; // 2K buffer
     // connect to the zSeries via BlueZone Mainframe Display
     pHost->Connect( "A", &nRetval );
     if ( nRetval == S_OK )
     {
          // login to the zSeries
          pHost->SendKey( L"logon guest@E", &nRetval );
          pHost->WaitReady( 10, 1, &nRetval );
          pHost->SendKey( L"password@E", &nRetval );
          pHost->WaitReady( 10, 1, &nRetval );
          pHost->SendKey( L"@E", &nRetval );
          pHost->WaitReady( 10, 1, &nRetval );
          // copy the host screen and display in a message box
          pHost->ReadScreen( Buf, 1920, 1, 1, &nRetval );
          MessageBox( NULL, Buf, "BHAO Sample Program", MB_OK );
          // logoff of zSeries
          pHost->SendKey( L"@3", &nRetval );
          pHost->WaitReady( 10, 1, &nRetval );
          pHost->SendKey( L"logoff@E", &nRetval );
          pHost->WaitReady( 10, 1, &nRetval );
     }
     else
     {
          char ErrorMsg[ 64 ];
          wsprintf( ErrorMsg, "Error %d connecting to host system.", nRetval );
          MessageBox( NULL, ErrorMsg, "Connect Error:", MB_OK );
     }
     // when done release the BlueZone Host Automation object
     pHost->Release( );
}
// don't forget to uninitialize COM when your're done
CoUninitialize( );