Establishing and Closing Connection with the D2000 Server

Establishing and Closing Connection with the D2000 Server

D2000 VBApi - Establishing and closing connection with the D2000 system

Before calling the procedures, that communicate with the system kernel (the process D2000 Server), it is necessary to connect them. The connection includes two operations:

  • creating a communication route

  • user logon

These operations are provided by the procedure VBApiLogOn.

The VBApiLogOnEx procedure allows you to specify additional  start parameters that modify the process behavior. 

Declaration

Declare Sub VBApiLogOn Lib "vbapi.dll" Alias "_LogOn@24" (ByRef server As String, ByRef procDesc As String, ByRef name As String, ByRef pass As String, ByRef wdFreq As Long, ByRef ok As Long) or Declare Sub VBApiLogOnEx Lib "vbapi.dll" Alias "_LogOnEx@24" (ByRef server As String, ByRef procDesc As String, ByRef name As String, ByRef pass As String, ByRef connStr As String, ByRef ok As Long)

Parameters

server

To create a communication route, it is necessary to know the name of the computer with running D2000 Server process (the parameter server). The meaning of this parameter is the same as the meaning of the parameter/S given on the command line during the start of a standard client process of the system.

For the VBALogOnEx function: When connecting to a redundant group, it is necessary to enter the parameter as an empty string. The connection is performed that through the connStr parameter we use the start parameter /RF or /RD.

procDesc

In older versions (4.10 and older), the parameter specified a name of the client process, with which the interface connects to the system, with the automatic extension .API. The parameter substituted the parameter /W from the command line.

Since the version 4.10, the parameter is informative only. The value of the parameter is stored into the log database of the system during the process start (suitable for the interface identification for the debug purposes). The process name, with which the interface connects to, is generated automatically and its structure is:

WsName_XX.VBA.

where: WsName - name of the computer in the network. The characters in the computer's name, that do not match the naming convention of objects for the D2000, are substituted by the character _.
XX - value from 00 up to 99 .VBA - process extension (in previous versions - .API)

name

Name of the user.
There are to be applied all restrictions of their access rights.

pass

User password.

connStr

Parameter of the string type. It allows you to specify additional start parameters that modify the process behavior.

wdFreq

Interval for sending watch dog messages used for verifying the communication route functionality. The parameter substitutes the parameter /F from the command line.

ok

Return value - successful call.

Return value

Value of the parameter ok.
 

Return value

Meaning

Return value

Meaning

0

Connect and login successful.

1

Unable to repeat the connection.

2

The D2000 Server not running.

3

Incorrect name or password (connect ok, but user is not logged on).

4

Internal error.


The procedure VBApiLogOff is used for closing the connection with the process D2000 Server.


Declaration

Declare Sub VBApiLogOff Lib "vbapi.dll" Alias "_LogOff@0" ()

Note

The connection is closed (terminated) when the library is unloaded from the memory after the MS Excel termination.


Related pages:

D2000 VBApi