Private Sub Command1_Click()
Dim i, m As Integer
Dim s As String
If IsLetter(Text1.Text) <> 1 Then
MsgBox ("用户名不得为空,且只能为英文字母!")
Else
s = Text1.Text
s = UCase(s)
m = 0
For i = 1 To Len(s)
If i = 11 Then Exit For '教训啊!!!
m = m + Asc(Mid(s, i, 1))
Next i
m = m Xor &H5678
m = m Xor &H1234
Text2.Text = Trim(Str(m))
End If
End Sub
Function IsLetter(lstr As String) As Integer
'判断一个字符串是否为全为字母,如全为英文字母返回值为1,包含非字母返回值为2,未输入返回值为0。
Dim i As Integer
If lstr = "" Then
IsLetter = 0
Exit Function
Else
IsLetter = 1
For i = 1 To Len(lstr)
If Not ((Asc(Mid(lstr, i, 1)) > 64 And Asc(Mid(lstr, i, 1)) < 91) Or (Asc(Mid(lstr, i, 1)) > 96 And Asc(Mid(lstr,
i, 1)) < 123)) Then
IsLetter = 2
Exit Function
End If
Next i
End If
End Function
int r = 0;
i=0;
do
{
c = uname[i];
r += c;
i++;
}while(c != 0);
r ^= 0x5678;
return r;
}
DWORD regsnCheck(char * sn)
{
char c;
char a;
int r = 0;
int i = 0;
a = 0x0a;
while((c = sn[i]) != 0)
{