VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   4590
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7875
   LinkTopic       =   "Form1"
   ScaleHeight     =   4590
   ScaleWidth      =   7875
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton TestBtn 
      Caption         =   "Test"
      Height          =   375
      Left            =   3000
      TabIndex        =   1
      Top             =   4080
      Width           =   1575
   End
   Begin VB.ListBox List1 
      Height          =   3765
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   7575
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' ==========================================================
' find, open and close ROCKEY
' ==========================================================

Private Sub TestBtn_Click()
Dim errcode, num, hic, i As Long
Dim curline As Integer

curline = 0

num = DIC_Find()
List1.List(curline) = "Searching ROCKEY: " & num
curline = curline + 1
If (num <= 0) Then
    List1.List(curline) = "No ROCKEY found " & num
    Exit Sub
End If

List1.List(curline) = "Open ROCKEY"
curline = curline + 1
For i = 0 To num - 1
    hic = DIC_Open(i, 0&)
    If (hic >= 0) Then
        Exit For
    End If
Next i
If (i = num) Then
    List1.List(curline) = "No ROCKEY found"
    Exit Sub
End If

' ...
' Operate ROCKEY
' ...

List1.List(curline) = "Close ROCKEY"
curline = curline + 1
errcode = DIC_Close(hic)
If (errcode <> SCARD_S_SUCCESS) Then
    List1.List(curline) = "Error code: " & Hex(errcode)
    Exit Sub
End If

End Sub

