dim ghsObj as GHS.Application
set ghsObj = New GHS.Application
Or if using a scripting language, an Application object would
be created as follows,
set ghsObj = CreateObject("GHSCOM.Application")
Note: CreateObject("GHSCOM.Application") should only be used in
scripting languages as this is much slower than the "dim xxx As
GHS.Application" method. VB and VBA support both methods. The
first method is the only way VB Script can create the object.
An example of linking to GHSCOM in the C++ language is provided
in the sample file named CallFromC.cpp that is included with the
When linked to the host program, the GHSCOM Application interface
provides three functions that allow sending commands to GHS and
querying for variable values. These functions are described below.
This function provides for execution of a GHS command string.
Only one command should be given in this string since the "|"
command separator is not supported here as it is in the standard
GHS command interface.
Command(commandString As String)
HRESULT Command(BSTR commandString)
This function gets the current contents of a GHS variable as a
GetVariableString(variableName As String) As String
HRESULT GetVariableString(BSTR variableName, BSTR* contents)
Similar to GetVariableString, this function gets the contents
of a GHS variable as a real numeric value. If the variable is
actually a string-type and cannot be converted to a number, the
returned value is zero.
GetVariableValue(variableName As String) As Single
HRESULT GetVariableValue(BSTR variableName, float* value)
GHSCOM supports the ISupportErrorInfo COM interface. This means
that information about errors is available through the VBA "Err"
object or via GetErrorInfo in C++. For example, in VB,
on error resume next
if Err.Number<>0 then
As mentioned above, a subset of the GHS Main Program commands
are available through GHSCOM. There is no access to MC, SE, LE,
CG or any module accessed throught the ENTER command.
It should be noted that the GHSCOM interface can access only one
instance of GHSCOM at any time. No matter how many IApplication
objects it creates, they all refer to the same instance of GHS.