Example VB6 source code
Previous Top Next

Private Declare Function SetEnvironmentVariable Lib "Kernel32" Alias "SetEnvironmentVariableA" (ByVal lpName As String, ByVal lpValue As String) As Long
Private Declare Function GetEnvironmentVariable Lib "Kernel32" Alias "GetEnvironmentVariableA" (ByVal lpName As String, ByVal lpBuffer As String, ByVal nSize As Long) As Long


Private Sub Command1_Click()
text_key = Text1
SetEnvironmentVariable "TS_CURRENT_KEY", text_key
End Sub

Private Sub Command2_Click()
Dim current_key As String * 255
GetEnvironmentVariable "TS_CURRENT_KEY", current_key, Len(current_key)
MsgBox "The current license key is " + current_key
End Sub