Further information about imported libraries can be found when choosing quick-preview
for the corresponding library from the explorer.
Visual Basic: To run this example program more than once it is recommended
to set the program back by confirming (run -> end).
Parameters which are passed back by ECIS-functions (output) should have sufficient
memory (e.g. approx. 200 characters for ecis_connect for connectionID, and ecis_call
for returnCode). In the following example the variable "BUFFER" is
used for this.
When starting the example program the DTV client should be opened as a window
in the background (not minimized in the task-bar).
Option Explicit
Module exampleECI
|
|
'-----------------------------------------------------------------------------------
' General information
'
' Name : exampleECI (exampleECI.vb)
'
' Purpose : Visual basic Example
'
' Dependencies : ECI shared libraries
'-----------------------------------------------------------------------------------
|
|
|
'-----------------------------------------------------------------------------------
' Declaration of the native ECI functions
'-----------------------------------------------------------------------------------
|
|
|
declare function ecis_add_par |
lib |
"epshr_eci.dll" |
|
(byval variab as string, byval initial as string) as integer
|
declare function ecis_cre_par
|
lib
|
"epshr_eci.dll"
|
|
(byval variab as string, byval zeichen as string) as integer
|
declare function ecis_end_par
|
lib
|
"epshr_eci.dll"
|
|
(byval variab as string) as integer
|
declare function ecis_des_par
|
lib
|
"epshr_eci.dll"
|
|
(byval variab as string) as integer
|
declare function ecis_set_par
|
lib
|
"epshr_eci.dll"
|
|
(byval cp_FunctionParameter as string, byval cp_ParNum as
string) as integer
|
declare function ecis_get_par
|
lib
|
"epshr_eci.dll"
|
|
(byval cp_FunctionParameter as string, byval cp_Data as string)
as integer
|
|
|
declare function ecis_connect
|
lib
|
"epclt_eci.dll"
|
|
(byval cp_ConnectionId as string, byval cp_Connection_Type
as string,
byval cp_Node as string, byval cp_Ressource as string, byval
cp_PartnerId as string,
byval cp_Myld as string) as integer
|
declare function ecis_call
|
lib
|
"epclt_eci.dll"
|
|
(byval cp_ConnectionId as string, byval cp_FunctionCode as
string,
byval cp_FunctionParameter as string, byval cp_ReturnCode
as string,
byval cp_ReturnParameter as string) as integer
|
declare function ecis_close
|
lib
|
"epclt_eci.dll"
|
|
(byval cp_ConnectionId as string) as integer
|
|
|
|
'-----------------------------------------------------------------------------------
' Buffer constant to provide memory for several output variables
' (long string of 200 space charaters)
'-----------------------------------------------------------------------------------
|
|
|
public const BUFFER as string =" "
Public Function EciConnect()
|
|
|
'-----------------------------------------------------------------------------------
' Creates an ECI connection with standard parameters
' input : none
' returns : connectionID
'----------------------------------------------------------------------------------- |
|
|
Dim connectionID As String
dim connectionType as string
dim node as string
dim ressource as string
dim serverID as string
dim clientID as string
dim result as integer
connectionID = BUFFER ' initialize output variable with sufficient
memory
connectionType = "1" ' type of ipc connection
ressource = "44444" ' identificator of IPC-Ressource
node = "localhost" ' name of host where the PLM client
is running
serverID = "PLM" ' identificator of partner-process
clientID = "MSWord" ' identificator of own process
result = ecis_connect(connectionID, connectionType, node, ressource,
serverID, clientID)
if (result <> 0) then
|
|
|
call msgbox("Cannot connection to PLM!", 0, "ECI
Error")
|
|
|
end if
return (connectionID)
|
|
|
End Function
Public Sub EciDisconnect(connectionID as
string)
|
|
|
'-----------------------------------------------------------------------------------
' Closes an ECI connection
' input : connectionID
' returns : none
'----------------------------------------------------------------------------------- |
|
|
|
End Sub
Public Sub PrintPlmUser()
|
|
|
'-----------------------------------------------------------------------------------
' Prints the user/group information of an ECI connection
' input : connectionID
' returns : none
'----------------------------------------------------------------------------------- |
|
|
Dim connectionID As String
dim functionName as string
dim inputPar as string
dim outputPar as string
dim value as string
dim returnCode as string
dim result as integer
connectionID = EciConnect()
functionName = "eci_rea_edb_usr"
outputPar = "eci_rea_edb_usr_out"
inputPar = "eci_rea_edb_usr_in"
result = ecis_cre_par(inputPar, "100")
result = ecis_cre_par(outputPar, "100")
returnCode = BUFFER
result = ecis_call(connectionID, functionName, inputPar, returnCode,
outputPar)
if (result <> 0) then
|
|
|
call msgbox("ECI call failed!", 0, "ECI
Error") |
|
|
|
value = BUFFER
result = ecis_set_par(outputPar, "1")
result = ecis_get_par(outputPar, value)
call msgbox(value, 0, "PLM user of the connection")
value = BUFFER
result = ecis_set_par(outputPar, "2")
result = ecis_get_par(outputPar, value)
call msgbox(value, 0, "PLM group of the connection") |
|
|
end if
result = ecis_des_par(outputPar)
result = ecis_des_par(inputPar)
EciDisconnect(connectionID)
|
|
|
End Module |