beautypg.com

Getting a list of available libraries, The logon process – Kofax DM API User Manual

Page 28

background image

8

C

HAPTER

1

The Logon Process

Getting a List of

Available Libraries

The following example displays a list of libraries managed by the DM
Server that the user can log on to.

.

.

.

Private Declare Function GetUserName Lib _

"advapi32.dll" Alias "GetUserNameA" _

(ByVal lpbuffer As String, nSize As Long) _

As Long

Public OK As Boolean

Private Sub Form_Load()

Dim sBuffer As String

Dim lSize As Long

Dim libname As String

Dim i As Long

Dim lim As Long

Dim opOK As Boolean

Dim Libs As New PCDGetLoginLibs

'Initialize public variables.

OK = False

dst = ""

user = ""

library = ""

group = ""

'Get the user we are currently logged on as.

sBuffer = Space$(255)

lSize = Len(sBuffer)

Call GetUserName(sBuffer, lSize)

If lSize > 0 Then

txtUserName.Text = Left$(sBuffer, lSize)

Else

txtUserName.Text = vbNullString

End If

'Get the list of available libraries

'and fill in combo box.

Libs.Execute

lim = Libs.GetSize() - 1

opOK = Libs.ErrNumber = 0

LibCombo.Text = ""

For i = 0 To lim