Public Function Decrypt(ByVal strSource As String, ByVal Key As Byte) As String
    Dim i     As Long
    Dim J     As Long
    Dim temps     As String
    Dim s     As String
    Dim arr     As Variant
    i = Len(strSource)
    If i Mod 2 = 1 Then
        '待解密的字串不符合要求
        Decrypt = ""
        Exit Function
    End If
    Dim buff()     As Byte
    Dim K     As Long
    K = 0
    For i = 1 To Len(strSource) Step 2
        temps = Mid(strSource, i, 2)
        J = Val("&H" & temps)
        J = J Xor Key
        ReDim Preserve buff(K)
        buff(K) = J
        K = K + 1
    Next
    Decrypt = StrConv(buff, vbUnicode)
End Function上面是VB的.下面是我改造成delphi的
function TForm3.Decode(strSource: String; Key: Byte): String; //界面字符串
var
  i,j,k,n:Integer;
  temps,s:string;
begin
  i:=Length(strSource);
  if i mod 2=1 then
    begin
      Result:='';
      Exit;
    end;
 k:=0;
 for i:=1 to Length(strSource) do
 begin
     temps:=Copy(strSource,i+n,2);
     j:=StrToInt('$'+temps);
     j:=j xor Key;  end;end;到了buff这个就写不下去了.不知道vb中的这个数组和delphi怎么对应.请高手指点