Visual Basic Example

This document provides examples on how to create a Visual Basic object with the DCOM Wrapper and how to use the properties of this object.

Define an Object :

Dim OLEObj as Object

Create an Object :

Set OLEObj = CreateObject("<Object Name>")

Retrieve User ID :

Dim sUserID As String
sUserID = OLEObj.UserID

Retrieve RPC User ID :

Dim sRpcUserID As String
sRpcUserID = OLEObj.RpcUserID

Retrieve Timeout Value :

Dim lTimeOut As Integer
lTimeOut = OLEObj.TimeOut

Retrieve and display Server Address :

MsgBox "Server Address : " & OLEObj.ServerAddress

Retrieve Token :

Dim sToken As String
sToken = OLEObj.Token

Retrieve Library :

Dim sLibrary As String
sLibrary = OLEObj.Library

Retrieve Compression :

Dim sCompression As String
sCompression = OLEObj.Compression

Retrieve Natural Logon :

Dim sNaturalLogon As String
sNaturalLogon = OLEObj.NaturalLogon

Retrieve Error Class :

Dim sErrorClass As Long
sErrorClass = OLEObj.ErrorClass

Retrieve Error Number :

Dim sErrorNumber As Long
sErrorNumber = OLEObj.ErrorNumber

Retrieve Error Message :

Dim sErrorMessage As String
sErrorMessage = OLEObj.ErrorMessage

Display Error Message :

Use the Description property of Visual Basic's Error object, for example:

On Error GoTo frmload_ErrProc
...
frmload_ErrProc:
MsgBox Err.Description, Err.Source

Set User ID :

OLEObj.UserID = "<User ID>"

Set Password :

OLEObj.Password = "<Password>"

Set NewPassword :

OLEObj.NewPassword = "<NewPassword>"

Set RPC User ID :

OLEObj.RpcUserID = "<RpcUser ID>"

Set RPC Password :

OLEObj.RpcPassword = "<RpcPassword>"

Set Server Address :

OLEObj.ServerAddress = "<Server Address>"

Set Time Out Value :

OLEObj.TimeOut = <Timeout value>

Set Token :

OLEObj.Token = "<Token>"

Set Library :

OLEObj.Library = "<Library Name>"

Set Compression :

OLEObj.Compression = "<Compression Type>"
<Compression Type> ::= '<blank>' | '2'

Set Natural Logon :

OLEObj.NaturalLogon = "<Natural Logon>"
<Natural Logon> ::= 'Y' | 'N'

Open Conversation :

OLEObj.OpenConversation

Close Conversation with Backout:

OLEObj.CloseConversation

Close Conversation with Commit :

OLEObj.CloseConversationCommit

Broker Logon :

OLEObj.Logon

Broker Logoff :

OLEObj.Logoff

Setting up User ID and Timeout Value using Method SetInfo:

OLEObj.SetInfo UserID:=tbUserID.Text, TimeOut:=30

Similarly, other named parameters can be used for setting connection and user-specific information. Other named parameters are as follows :

Named Parameter Purpose
UserID Sets User ID, maximum 32 characters long.
Password Sets Password, maximum 32 characters long.
NewPassword Sets NewPassword, maximum 32 characters long.
Token Sets Token, maximum 32 characters long.
BrokerID Sets Broker ID, maximum 32 characters long.
ServerName Sets Server Name, maximum 32 characters long.
ServerClass Sets Server Class, maximum 32 characters long.
ServiceName Sets Service Name, maximum 32 characters long.
TimeOut Sets Timout value, timeout value is validated at server end. Cannot be less than or equal to 0.
RpcUserID Sets RPC User ID, maximum 32 characters long.
RpcPassword Sets RPC Password, maximum 32 characters long.
ForceLogon Determines whether explicit or auto-logon is used by the caller.
SSLString Used for setting SSL parameters.
CompressLevel Compression level. Valid values: N/Y/0-9.

Only the first character of the string will be used for the compression. If you type YES, the character Y will be used and ES will be cut off.

See also Data Compression in EntireX Broker.