User Manual HTS Hengstler Terminal Server for Windows

Add to My manuals
31 Pages

advertisement

User Manual HTS Hengstler Terminal Server for Windows | Manualzz

OLE

HTS displays each OLE request currently under service in the main window’s column “active DDE connections”. Each new request gets a new sequential number. The examples below show you can implement the OLE interface into your application.

Excel and Visual Basic

The most easy implementation is offered by Visual Basic which belongs to Microsoft Excel. In the example the count value is read from the counter with the logical terminal number 25 and its preset_1 register is set to a value taken from a table cell.

' Logical Counter address

Konst CounterAddress = 25

' Registers of counter

Konst CountValue = 0

Konst Preset1 = 1

Konst Preset2 = 2

Konst Chain = 3

' Buffer variable

Dim Buffer As Single

' Counter value is read an written into table

Sub Read_Counter()

Set Hts = GetObject(Class:="Hengstler.TerminalServer.10")

Result = Hts.ReadRegister(CounterAddress; CountValue)

Sheets("Table1").Cells(6; 2).Value = Result

End Sub

Sub Write_Preset()

Buffer = Sheets("Table1").Cells(2; 2).Value

Set Hts = GetObject(Class:="Hengstler.TerminalServer.10")

Result = Hts.WriteRegister((CounterAddress; Preset1; Buffer)

End Sub

Sub Read_Clear_Counter()

Set Hts = GetObject(Class:="Hengstler.TerminalServer.10")

Result = Hts.ClearRegister(CounterAddress; CountValue)

Sheets("Table1").Cells(6; 2).Value = Result

End Sub

Example: OLE with Visual Basic page 22 HTS for Windows

advertisement

Related manuals