source code program trial version

Download Source Code Program Trial Version

If you can't read please download the document

Upload: gilang-on-wp

Post on 24-Sep-2015

221 views

Category:

Documents


6 download

DESCRIPTION

VB6

TRANSCRIPT

Option Explicit Private Declare Function GetVolumeInformation Lib Kernel32? _Alias GetVolumeInformationA (ByVal lpRootPathName As String, _ByVal lpVolumeNameBuffer As String, _ByVal nVolumeNameSize As Long, _lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, _lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, _ByVal nFileSystemNameSize As Long) As Long Private Function GetHDDSerialNumber(ByVal DriveLetter As String) As StringDim SN As LongDim VolumeNameBuff As StringDim FileSystemBuff As String VolumeNameBuff = String$(255, Chr$(0))FileSystemBuff = String$(255, Chr$(0))GetVolumeInformation UCase(DriveLetter) & :\, _VolumeNameBuff, 255, SN, 0, 0, FileSystemBuff, 255GetHDDSerialNumber = Trim(Hex$(SN))End Function Private Function CreateAppSerialNumber _(ByVal HDDSerialNumber As String) As StringDim i As IntegerDim temp As StringDim temp2 As String temp = EmptyFor i = 1 To Len(HDDSerialNumber) Step 2temp = temp & Mid(HDDSerialNumber, i + 1, 1) & _Mid(HDDSerialNumber, i, 1)Next For i = Len(temp) To 1 Step -1Select Case Asc(Mid(temp, i, 1)) + 1Case 48 To 57, 65 To 90, 97 To 122temp = temp & Chr(Asc(Mid(temp, i, 1)) + 1)Case Elsetemp = temp & Mid(temp, i, 1)End SelectNext For i = 1 To Len(temp) Step 2temp2 = temp2 & Mid(temp, i, 1) & _Mid(temp, Len(temp) \ 2 + i, 1)Next CreateAppSerialNumber = temp2End Function Public Function CreateActivationKey _(ByVal AppSerialNumber As String) As StringDim i As IntegerDim j As IntegerDim temp As String temp = EmptyFor i = 1 To Len(AppSerialNumber) \ 2temp = temp & (Asc(Mid(AppSerialNumber, i, 1)) Xor _Asc(Mid(AppSerialNumber, Len(AppSerialNumber) \ 2 + 1, 1)))NextCreateActivationKey = Hex$(Val(temp))End Function Private Sub Form_Load()txtSerialNumber.Text = CreateAppSerialNumber(GetHDDSerialNumber(c))End Sub Private Sub cmdHint_Click()MsgBox Activation Key: & _CreateActivationKey(CreateAppSerialNumber _(GetHDDSerialNumber(C)))End Sub Private Sub cmdOK_Click()If txtActivationKey.Text = CreateActivationKey(txtSerialNumber.Text) ThenMsgBox Thank you!, vbOKOnly Or vbInformation, App.TitleElseMsgBox Wrong answer!, vbOKOnly Or vbInformation, App.TitleEnd IfEnd Sub Private Sub cmdCancel_Click()Unload MeEnd Sub