VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Driver Setup Sample of SoftDogSetup.dll"
   ClientHeight    =   3615
   ClientLeft      =   45
   ClientTop       =   345
   ClientWidth     =   5115
   LinkTopic       =   "Form1"
   ScaleHeight     =   3615
   ScaleWidth      =   5115
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton CloseButton 
      Caption         =   "&Close"
      Height          =   375
      Left            =   3960
      TabIndex        =   4
      Top             =   3000
      Width           =   855
   End
   Begin VB.CommandButton DisplayDialog 
      Caption         =   "&DisplayInstallInterface"
      Height          =   375
      Left            =   1920
      TabIndex        =   1
      Top             =   2400
      Width           =   1695
   End
   Begin VB.CommandButton GetDrvInfo 
      Caption         =   "&GetDogDriverInfo"
      Height          =   375
      Left            =   120
      TabIndex        =   0
      Top             =   2400
      Width           =   1455
   End
   Begin VB.CommandButton Uninstall 
      Caption         =   "&UninstallDriver"
      Height          =   375
      Left            =   1920
      TabIndex        =   3
      Top             =   3000
      Width           =   1695
   End
   Begin VB.CommandButton Install 
      Caption         =   "&InstallDriver"
      Height          =   372
      Left            =   120
      TabIndex        =   2
      Top             =   3000
      Width           =   1452
   End
   Begin VB.Label Resultbox 
      BorderStyle     =   1  'Fixed Single
      Height          =   1215
      Left            =   120
      TabIndex        =   6
      Top             =   960
      Width           =   4695
      WordWrap        =   -1  'True
   End
   Begin VB.Label copyright 
      Height          =   495
      Left            =   120
      TabIndex        =   5
      Top             =   240
      Width           =   4935
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim RetCode As Integer


Private Sub CloseButton_Click()
    Unload Me

End Sub

Private Sub DisplayDialog_Click()
    RetCode = DriverDialog()
End Sub

Private Sub Form_Load()
    copyright = "Driver setup sample of SoftDogSetup.dll" + vbCrLf + "Copyright (C) 2007 SafeNet China Co Ltd. All Rights Reserved."
    
    Resultbox = "Click GetDogDriverInfo to get the information of dog driver"
    Resultbox = Resultbox + vbCrLf + "Click DisplayInstallInterface to display install interface"
    Resultbox = Resultbox + vbCrLf + "Click Install Driver to Install the Dog driver "
    Resultbox = Resultbox + vbCrLf + "Click Uninstall Driver to Uninstall the Dog driver."
End Sub

Private Sub GetDrvInfo_Click()
Dim RetCode1 As Long

    RetCode1 = GetDogDriverInfo()
    If RetCode1 = 0 Then
    Resultbox = "Not find Dog driver"
    ElseIf RetCode1 = 1 Then
    Resultbox = "Find the same version USBDog and ParallelDog driver."
    ElseIf RetCode1 = 2 Then
    Resultbox = "Find the same version USBDog driver only."
    ElseIf RetCode1 = 3 Then
    Resultbox = "Find the same version ParallelDog driver only."
    ElseIf RetCode1 = 4 Then
    Resultbox = "Find the older version USBDog and ParallelDog driver."
    ElseIf RetCode1 = 5 Then
    Resultbox = "Find the older version USBDog driver only."
    ElseIf RetCode1 = 6 Then
    Resultbox = "Find the older version ParallelDog driver only."
    ElseIf RetCode1 = 7 Then
    Resultbox = "Find the newer version USBDog and ParallelDog driver."
    ElseIf RetCode1 = 8 Then
    Resultbox = "Find the newer version USBDog driver only."
    ElseIf RetCode1 = 9 Then
    Resultbox = "Find the newer version ParallelDog driver only."
    ElseIf RetCode1 = 3008 Then
    Resultbox = "Please log on with administrator identity!."
    Else
    Resultbox = "Not find Dog driver"
    End If
    
    
    

End Sub

Private Sub Install_Click()
    Install.Enabled = False
    Uninstall.Enabled = False
    DisplayDialog.Enabled = False
    GetDrvInfo.Enabled = False
    CloseButton.Enabled = False
    
        
        
    RetCode = InstDrv(3) '1 install USB dog driver
                         '2 install Parallel dog driver
                         '3 install both USB dog driver and Parallel dog driver
     
    If RetCode = 0 Then
        Resultbox = "The driver has been installed successfully."
        Install.Enabled = False
    Else
        Install.Enabled = True
        If RetCode = 3008 Then
            Resultbox = "Please log on with administrator identity."
        Else
            Resultbox = "The driver's installation failed. Error code: " + Str(RetCode)
        End If
            
    End If
        Uninstall.Enabled = True
        DisplayDialog.Enabled = True
        GetDrvInfo.Enabled = True
        CloseButton.Enabled = True

End Sub

Private Sub Uninstall_Click()
    Install.Enabled = False
    Uninstall.Enabled = False
    DisplayDialog.Enabled = False
    GetDrvInfo.Enabled = False
    CloseButton.Enabled = False
    Resultbox = "Uninstall the driver ,Please wait......"
    
    RetCode = UninstDrv(3) '1 uninstall USB dog driver
                           '2 uninstall Parallel dog driver
                           '3 uninstall both USB dog driver and Parallel dog driver
    
     
    If RetCode = 0 Then
       Resultbox = "The driver has been uninstalled successfully."
       Uninstall.Enabled = False
    Else
       
        If RetCode = 3008 Then
            Resultbox = "Please log on with administrator identity."
        Else
            Resultbox = "The driver's uninstallation failed. Error code: " + Str(RetCode)
        End If

       Uninstall.Enabled = True
    End If
    
    Install.Enabled = True
    DisplayDialog.Enabled = True
    GetDrvInfo.Enabled = True
    CloseButton.Enabled = True

End Sub
