D2000 VBApi - Establishing and closing connection with 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 process D2000 Server (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.

procDescIn 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 D2000, are substituted by the character _.
XX
- value from 00 up to 99 .VBA - process extension (in previous versions - .API)

nameName of user.
There are to be applied all restrictions of his/her access rights.
passUser password.
connStrParameter of the string type. It allows you to specify additional  start parameters that modify the process behavior.
wdFreqInterval for sending watch dog messages used for verifying the communication route functionality. The parameter substitutes the parameter /F from the command line.
okReturn value - success call.


Return value
Value of the parameter ok.
 
Return valueMeaning
0Connect and login successful.
1Unable to repeat connect.
2D2000 Server not running.
3Incorrect name or password (connect ok, but user is not logged on).
4Internal 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:

0 komentárov

Nie ste prihlásený. Akékoľvek zmeny, ktoré vykonáte, sa označia ako anonymné. Ak už máte svoj účet, pravdepodobne sa budete chcieť prihlásiť .