Attribute VB_Name = "Module1"
'//************************************************************************/
'// [Caution]: this sample is only a demo how to install ePass1000 driver,
'//            If you want to install ePass1000 middleware, please change the
'//            "ePsInst_drv.dll" to "ePsInst_mw.dll",
'//            and change the parameter "/c2" of esa_DoInstall() to "/a"
'//***********************************************************************/
Option Explicit

Global Const NOTIFY_DELETEFILE_REBOOT = 1
Global Const NOTIFY_DELETEFILE_RETRY = 2
Global Const NOTIFY_DELETEFILE_CANCEL = 3

Declare Sub esa_SetDeleteFileCallback Lib "ePsInst_drv.dll" (ByVal fNotify As Long)
Declare Sub esa_SetShowMsgNotifyCallback Lib "ePsInst_drv.dll" (ByVal fNotify As Long)
Declare Sub esa_SetShowErrMsgNotifyCallback Lib "ePsInst_drv.dll" (ByVal fNotify As Long)
Declare Function esa_DoInstall Lib "ePsInst_drv.dll" (ByVal strPram As String) As Boolean
Declare Function esa_DoUninstall Lib "ePsInst_drv.dll" (ByVal strPram As String) As Boolean
Declare Function esa_IsNeedReboot Lib "ePsInst_drv.dll" () As Boolean
Declare Function esa_LongToVbStr Lib "ePsInst_drv.dll" (ByVal sText1 As String, ByVal sText2 As Long) As Long


Function HelperLongToStr(ByVal hStr As Long) As String
Dim sTmp  As String * 512
Dim sRet  As String
Dim iLen  As Long

    iLen = esa_LongToVbStr(sTmp, hStr)
    sRet = Mid(sTmp, 1, iLen)
    HelperLongToStr = sRet
End Function

Function MyDeleteProc(ByVal hStr As Long) As Long
    Dim strMsg As String
    
    strMsg = HelperLongToStr(hStr)
    MyDeleteProc = Form1.OnInstDelete(strMsg)
End Function

Sub MyProcessProc(ByVal hStr As Long)
    Dim strMsg As String
    
    strMsg = HelperLongToStr(hStr)
    Form1.OnInstProcess (strMsg)
End Sub

Sub MyErrProc(ByVal hStr As Long)
    Dim strMsg As String
    
    strMsg = HelperLongToStr(hStr)
    Form1.OnInstErr (strMsg)
End Sub

