1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Attribute VB_Name = "TGSIntf"
'One and only Root Object of GS/SS SDK, can only be accessed after calling GSInit
Public gs As TGS


'[INTERNAL ] ******************************* Native Low-Level API *********************************************
Private Declare Function gsStrLen Lib "gsCore.dll" Alias "#163" (ByVal pchar As Long) As Integer
Private Declare Sub gsStrCopy Lib "gsCore.dll" Alias "#164" (ByVal desStr As String, ByVal srcPChar As Long, ByVal desStrLen As Long)
Public Declare Sub gsCloseHandle Lib "gsCore.dll" Alias "#5" (ByVal handle As Long)


 

Public Sub SdkInitialize(Optional ByVal ProductId As String = "", Optional ByVal licFilePath As String = "", Optional ByVal Password As String = "")
    If gs Is Nothing Then
        Set gs = New TGS
        
        gs.ProductId = ProductId
        gs.Password = Password
        gs.LicenseFile = licFilePath
        
        '---------------------------------------------------------
        'make sure the gsCore.dll is side by side with the app exe
        'otherwise VB runtime won't find it
        '
        'you can also do it by calling Windows SetDllDirectory() api
        '---------------------------------------------------------
        ChDir App.Path
        
        'Initialize the app instance first
        gs.App.Init
        
    End If
End Sub

Public Sub SdkUninitialize()
    If Not gs Is Nothing Then
        gs.cleanUp
        
        Set gs = Nothing
    End If
End Sub

    

'[INTERNAL] Helper to convert const char* from C++ dll to string
Public Function PCharToStr(ByVal pchar As Long) As String
 Dim result As String
 Dim msgLen As Integer
 msgLen = gsStrLen(pchar)
 result = Space$(msgLen)
 
 Call gsStrCopy(result, pchar, msgLen)
 PCharToStr = result
End Function

Public Sub s_monitorCallback(ByVal eventId As Long, ByVal hEvent As Long, ByVal usrData As Long)
'[INTERNAL] event call back for all events
  Call gs.App.OnEventCallback(eventId, hEvent)
End Sub