For an introduction to API’s and emulator programming in IBM Personal Communications, refer to the link below:-
In this blog we will explore more about EHLLAPI APIs.
PCOMM provides functions to access emulator "presentation space" data (such as characters on the host screen), sending keystrokes to the host, intercepting user-entered keystrokes, querying the status of the host session, uploading and downloading files, etc. The different EHLLAPI programming interfaces are listed below:
The figure below showcases different EHLLAPI layers.
Any programming language which can invoke an entry point in a DLL with the "Pascal" calling convention can be used to execute EHLLAPI functions. However, the Personal Communications EHLLAPI toolkit provides header files and function prototypes only for the C++ languages. These are present under the ‘\Samples’ Directory. A clear understanding of data structure layout and calling conventions is required to use any other language. The EHLLAPI toolkit supports the following C/C++ compilers:
• Visual Basic for Automation
• Visual Basic Scripting
EHLLAPI C/C++ applications must include the Personal Communications EHLLAPI header file (HAPI_C.H).
EHLLAPI Call Format
The EHLLAPI entry point is always called with the following four parameters:
Function Name (EHLLAPI Function Number, Data Buffer, Buffer Length, Position/Return Code);
Compiling and linking
Applications using EHLLAPI functions must include the appropriate header file to obtain the proper function prototypes, constants, and data structure definitions. These header files may be used with any of the supported C/C++ compilers.
Note: If a different compiler or language is used, then you must provide your own equivalent definitions and structures. There are two possible ways to link the application program, depending on how the entry point is to be resolved.
The following table shows which header files to use for which flavour of EHLLAPI.
Function Calling convention
PCOMM Session APIs follow a simple prototype for all functions to keep the programming straightforward. As mentioned above these API’s can be accessed and programmed using multiple programming languages (VBA, C/C++, C#, etc).
Function Type Function Name (Arguments);
EHLLAPI Functions and their opcodes:
Below figure shows different EHLLAPI functions and their Opcodes. Details about these functions, Operations, Data type, Length and Return values can be found here
A Simple EHLLAPI ‘C’ Sample Program
The following sample windows application enters the character string "Hello World!" in the first input field of host session 'A'.
B. Main Function body and reset connection (if any)
C. Establish connection between program and emulator (Step A must be performed before any other steps)
D. Write “HelloWorld” on the Emulator Screen
E. Disconnect from the PCOMM Engine (Clean disconnect)
Download the Sample code
For further information on automation, and services offerings please email zServices@hcl.com or HCL-HI-LabServices@hcl.com.
Lead - Lab Services, IBM HACP & HATS