Dynamic Data Exchange (DDE)

"Interoperability" is a continual issue for all information technology software. If you can not transfer information between the applications you use, relatively simply, you face a difficult task in compeleting any job which needs them.

Hullform provides just such a facility, acting as a very flexible "Dynamic Data Exchange" ("DDE") server for any other application. You can extract a wide range of data from Hullform, into software like word processors and spreadsheets, using this facility.

DDE is a relatively simple data exchange protocol, in which text data, indentified by text-form labels, are requested and transmitted between compliant applications. The full range of data accepted and provided by Hullform is supplied with the program documentation, but includes matters like hydrostatic calculations and hull offsets.

In DDE-initiated hydrostatic calculations, relevant factors - like tank contents - are accepted from the requesting application, the program then performs hull balancing if required, and the results are returned on request. This means that some of the features of Hullstat are available using Hullform alone, with some suitable programming skills needed to create the required macro command scripts.

By way of example, the Word 2000 macro routine below reads all hull offsets and control points, and enters them into a table (It includes some commands ported from WordBasic, in which it was first developed):

NOTE: this will not work with the demonstration version. In parallel with the disabling of file and printer output, DDE responses have also been excluded.

Sub Line_Data()
'
' Line Data Macro
' Macro created 27/02/00 by Peter Rye
'
Dim H
Dim file$
Dim a$

H = WordBasic.DDEInitiate("HULLFORM", "STATICS")
If H <= 0 Then
    WordBasic.MsgBox "Could not find Hullform DDE Server"
    GoTo Exit_
End If
file$ = WordBasic.[InputBox$]("Enter hull data file name")
WordBasic.DDEExecute H, "open " + file$

'   Get hull data size

a$ = WordBasic.[DDERequest$](H, "linect")
numlin = WordBasic.Val(a$)
a$ = WordBasic.[DDERequest$](H, "sectct")
Count = WordBasic.Val(a$)

'   The extra [1]'s are to permit zero-based indices

Dim ps[1]
Dim sectps[count]
Dim lo[1]
Dim sectlo[count]
Dim vo[1]
Dim sectvo[count]
Dim lc[1]
Dim sectlc[count]
Dim vc[1]
Dim sectvc[count]

'   Create table

ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:="2", _
    NumColumns:=Str(2 + numlin * 4), _
    DefaultTableBehavior:=wdWord9TableBehavior, _
    AutoFitBehavior:=wdAutoFitContent

Selection.TypeText Text:="Index"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="Position"
Selection.MoveRight Unit:=wdCell
For j = 1 To numlin
    Selection.TypeText Text:="Y(" + Str(j) + ")"
    Selection.MoveRight Unit:=wdCell
    Selection.TypeText Text:="Z(" + Str(j) + ")"
    Selection.MoveRight Unit:=wdCell
    Selection.TypeText Text:="YC(" + Str(j) + ")"
    Selection.MoveRight Unit:=wdCell
    Selection.TypeText Text:="ZC(" + Str(j) + ")"
    Selection.MoveRight Unit:=wdCell
Next j
For I = 0 To Count - 1
    Selection.TypeText Text:=Str(I)
    Selection.MoveRight Unit:=wdCell
    a$ = WordBasic.[DDERequest$](H, "sectps[" + Str(I) + "]")
    Selection.TypeText Text:=a$
    Selection.MoveRight Unit:=wdCell
    For j = 1 To numlin
        WordBasic.DDEPoke H, "line", Str(j)
        a$ = WordBasic.[DDERequest$](H, "sectlo[" + Str(I) + "]")
        Selection.TypeText Text:=a$
        Selection.MoveRight Unit:=wdCell
        a$ = WordBasic.[DDERequest$](H, "sectvo[" + Str(I) + "]")
        Selection.TypeText Text:=a$
        Selection.MoveRight Unit:=wdCell
        a$ = WordBasic.[DDERequest$](H, "sectlc[" + Str(I) + "]")
        Selection.TypeText Text:=a$
        Selection.MoveRight Unit:=wdCell
        a$ = WordBasic.[DDERequest$](H, "sectvc[" + Str(I) + "]")
        Selection.TypeText Text:=a$
        Selection.MoveRight Unit:=wdCell
    Next j
Next I
WordBasic.DDETerminate H
WordBasic.DDETerminateAll
Exit_:
End Sub