One end of the software sequence good code, relatively simple, but there are worth learning from the place

Source: Internet
Author: User
Tags exit
Compare Function ifisserial ()

Dim owsh
Dim strserial
Dim arrserial
Dim Strchar
Dim IDX
Dim isummary

On Error Resume Next
Set WshShell = Server.CreateObject ("Wscript.Shell")
Strserial = WshShell.RegRead ("Hklm\software\asong\wjdh\productid")
Set WshShell = Nothing

If Len (strserial) <>23 Then
Ifisserial = False
Exit function
End If

arrserial = Split (Strserial, "-")
if (UBound (arrserial)-lbound (arrserial)) <>3 Then
Ifisserial = False
Exit function
End If

Isummary = 0

strserial = arrserial (0)
IDX = 1

Do While IDX <= 5
Strchar = Mid (strserial, IDX, 1)
Isummary = Isummary + (ASC (strchar) * 4)
IDX = idx + 1
Loop

Strserial = arrserial (1)
IDX = 1

Do While IDX <= 5
Strchar = Mid (strserial, IDX, 1)
Isummary = isummary + ASC (strchar) * 3
IDX = idx + 1
Loop

Strserial = arrserial (2)
IDX = 1

Do While IDX <= 5
Strchar = Mid (strserial, IDX, 1)
Isummary = isummary + ASC (strchar) * 2
IDX = idx + 1
Loop

Strserial = arrserial (3)
IDX = 1

Do While IDX <= 5
Strchar = Mid (strserial, IDX, 1)
Isummary = isummary + ASC (strchar)
IDX = idx + 1
Loop

If isummary <> 3364 Then
Ifisserial = False
Else
Ifisserial = True
End If

End Function



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.