# EHLLAPI, COM and .NET Session Automation | WND Software Docs

Source: https://wndsoftware.com/docs/ehllapi-com

### EHLLAPI, COM and .NET

Programs and scripts written for PCOMM, Extra! or Reflection work with WND Terminal without changes. IT turns the compatibility files on when it installs the app.

WND Terminal comes with EHLLAPI and WinHLLAPI DLLs in 32-bit and 64-bit, COM objects with the Extra!, PCOMM (autECL) and Reflection object models, and a .NET library for C#, UiPath and Power Automate. IT turns them on with MSI properties, and they never replace another vendor’s files.

On a small screen, swipe the table to read all columns.


| What | Detail |
| --- | --- |
| EHLLAPI and WinHLLAPI | 32-bit and 64-bit DLLs under the names programs load: `PCSHLL32.dll`, `EHLAPI32.dll`, `WHLAPI32.dll` and `WHLLAPI.dll`, and for 64-bit programs `PCSHLL64.dll`, `EHLAPI64.dll` and `WHLAPI64.dll` |
| COM objects | The object models of Extra! (`EXTRA.System`), PCOMM’s Host Access Class Library (`PCOMM.autECLSession`, `autECLPS`, `autECLOIA`, `autECLConnList`, `autECLConnMgr`), Reflection for IBM (`ReflectionIBM.Session`) and WND Terminal’s own (`WND.Terminal`), for VBA in Excel and Access, VBScript and PowerShell |
| .NET | `WndTerminal.Automation` for .NET Standard 2.0 and .NET 8, for C#, UiPath and Power Automate Desktop |
| Where | EHLLAPI and COM on Windows. All of it drives the sessions open in the person’s WND Terminal on the same computer. |

Everything goes through WND Terminal’s [automation API](https://wndsoftware.com/docs/automation-api), so its protections hold. Password fields read as blanks, card numbers and IT’s patterns are masked, `AllowCopy` = false stops programs reading the screen, and programs never see what the person types. Each program that connects is in the audit log by name, such as `EHLLAPI in claims.exe` or `COM automation in EXCEL.EXE`. `AllowAutomation` = false turns all of it off.


### Turn it on at install

The MSI installs the DLLs with the app, in `C:\Program Files\WND Terminal\compat\x86` and `compat\x64`. On their own they change nothing. Three MSI properties put them to use.

On a small screen, swipe the table to read all columns.


| Property | What it does |
| --- | --- |
| `HLLAPIFOLDER32` | Copies the 32-bit EHLLAPI DLL into this folder under the names above. Use the folder of the program that loads it, or a folder on its `PATH`. |
| `HLLAPIFOLDER64` | The same for 64-bit programs. |
| `COMPATCOM` | Registers COM objects for everyone on the PC: any of `wnd`, `extra`, `pcomm`, `reflection`, or `all`. Both sizes are registered, so 32-bit Office finds them. |


```text
msiexec /i WND-Terminal-Windows.msi /qn HLLAPIFOLDER32="C:\Apps\Claims" COMPATCOM="extra wnd"
```

Another vendor’s files and registrations are never touched. A DLL of the same name that isn’t WND Terminal’s is left where it is, and the installer log says so. A COM name another product still has registered stays with that product, so both can be installed while people move over. Uninstalling WND Terminal removes exactly what it copied and registered, and an upgrade keeps them. The copies and registrations are in the audit log (`compat.install`, `compat.uninstall`).

To do the same after installing, from a deployment script run as an administrator:


```text
wnd-terminal --compat-install --hllapi32 "C:\Apps\Claims" --com "pcomm"
wnd-terminal --compat-uninstall
```

Add `--user` to register the COM objects for the person running it, with no administrator rights. That’s how to use them with the per-user `setup.exe`.


### EHLLAPI

Programs call `hllapi(&function, data, &length, &rc)` as they do with PCOMM, Extra! or Reflection, or `WinHLLAPI` with `WinHLLAPIStartup`. The 32-bit DLL is `__stdcall`, as Visual Basic’s `Declare` needs. Sessions are WND Terminal’s short names, A, B, C and on, in the order they opened. The status line shows “Session A”.

On a small screen, swipe the table to read all columns.


| Functions | Notes |
| --- | --- |
| 1, 2 Connect and Disconnect Presentation Space | Return code 4 or 5 when the host has the keyboard, 11 when another program reserved it |
| 3 Send Key | SendKey mnemonics such as `@E` for Enter and `@1` for PF1. After an AID key mid-string, WND Terminal waits for the host before typing the rest. |
| 4 Wait, 18 Pause | TWAIT, LWAIT and NWAIT. IPAUSE ends when the host updates a session. |
| 5, 8 Copy Presentation Space (to String) | With attribute bytes or extended attributes when asked |
| 6, 30 Search Presentation Space, Search Field | Forward or backward, from the start or a position |
| 7, 40, 99 Cursor and positions | Query and set the cursor, and convert between positions and rows and columns |
| 9 Set Session Parameters | The usual options. Other emulators’ extra options are accepted. |
| 10, 20, 22 Query Sessions, System, Session Status | Short name, name, host type, screen size and code page |
| 11, 12 Reserve and Release | The person is told a program has the keyboard |
| 13, 14 Copy OIA, Query Field Attribute | The status line and indicator groups |
| 15, 33, 34 Copy String to Presentation Space and fields | Only into input fields |
| 23, 24, 25 Host notification | Start, query and stop |
| 31, 32 Find Field Position and Length | The usual field codes |

Text is passed in Windows code page 1252, one byte per screen position. If WND Terminal isn’t running, functions return 1, and the DLL connects again by itself once it is.


### COM objects


```text
' Extra!
Set Sys = CreateObject("EXTRA.System")
Set Screen = Sys.ActiveSession.Screen
Screen.WaitForString "Logon ===>"
Screen.SendKeys "LOGON wnduser<Enter>"

' Personal Communications
Set PS = CreateObject("PCOMM.autECLPS")
PS.SetConnectionByName "A"
PS.WaitForString "READY", 0, 0, 10000
PS.SendKeys "CADD[enter]"

' Reflection for IBM
Set R = CreateObject("ReflectionIBM.Session")
R.Transmit "wnduser"
R.TransmitTerminalKey "rcIBMEnterKey"
```

The objects are late bound, so VBScript, VBA with `Dim x As Object` and .NET `dynamic` find members by name. Reflection’s key constants come from its type library, so `TransmitTerminalKey` takes the constant’s name as text. A program bound early to a vendor’s type library, by CLSID or a VBA reference, needs that reference changed to late binding.


### .NET

`WndTerminal.Automation` has no dependencies and works from .NET Framework 4.6.1 and later, which covers UiPath and Power Automate Desktop.


```text
using WndTerminal.Automation;

using (var wnd = WndTerminalClient.Connect("Claims robot"))
{
    var a = wnd.Session("A");
    a.WaitForText("Logon ===>", 20);
    a.SendKeys("wnduser" + Keys.Enter);
    a.WaitReady(20);
    Console.WriteLine(a.GetText(2, 1, 5));
}
```


### What isn’t included

- Keystroke intercept (functions 50 to 53). Programs can’t see what the person types.
- EHLLAPI file transfer (functions 90 and 91). WND Terminal does IND$FILE and [FTP, FTPS and SFTP](https://wndsoftware.com/docs/file-transfer) itself.
- `WinHLLAPIAsync` and PCOMM’s enhanced EHLLAPI structures. The standard interface only.
- OHIO, IBM’s Java Open Host Interface Objects. Java programs can use the automation API directly.


### Related

[Automation API The protocol underneath, and wnd-automate. Read →](https://wndsoftware.com/docs/automation-api)
[Run your existing macros Extra!, Reflection and PowerTerm macros, as they are. Read →](https://wndsoftware.com/docs/legacy-macros)
[Install on Windows The MSI and its properties. Read →](https://wndsoftware.com/docs/install-windows)

### Questions


#### Do we have to change our EHLLAPI programs?

No. Copy WND Terminal’s DLL into the program’s folder with the MSI’s HLLAPIFOLDER32 or HLLAPIFOLDER64 property, under the name the program already loads, such as PCSHLL32.dll or EHLAPI32.dll.


#### Will it overwrite PCOMM’s or Reflection’s files?

No. A DLL that isn’t WND Terminal’s is left in place, and a COM name another product has registered stays with that product. Uninstalling WND Terminal removes only what it added.


#### Is OHIO supported?

No. IBM’s Java Open Host Interface Objects aren’t included. Java programs can use WND Terminal’s automation API directly.


#### Can programs read password fields?

No. Password fields always read as blanks, card numbers and your masking patterns are masked, and IT can turn the whole interface off with AllowAutomation = false.

Technical reviewer: [Albert Joseph](https://wndsoftware.com/authors/albert-joseph), WND Software.
