//ByValue在Delphi是什么类型我也不是很清楚//没有玩过VBfunction read_card(hiCC: Word; zone: Word; addr: Word; data_len: Word; Buffer: PChar): Integer; external 'STICCW32.DLL';
//Declare Function read_card Lib "STICCW32.DLL" (ByVal hiCC%, ByVal zone%, ByVal addr%, ByVal data_len%, ByVal dat$) As Integer
function check_code(hiCC: Word; code_length: Word; code: Byte): Integer; external  'STICCW32.DLL';
//Declare Function check_code Lib "STICCW32.DLL" (ByVal hiCC%, ByVal code_length%, code As Byte) As Integerprocedure TForm1.Button1Click(Sender: TObject);
//Private Sub Command10_Click()
var
  yOde: array[0..3] of Byte;
//Dim yOde(4) As Byte
  nstatus: Integer;
  nhiCC: Integer;
begin
  yOde[0] := $FF;
//yOde(0) = &HFF
  yOde[1] := $FF;
//yOde(1) = &HFF
  yOde[2] := $FF;
//yOde(2) = &HFF
  nstatus := check_code(nhiCC, 3, yOde[0]);
//nstatus% = check_code(nhiCC, 3, yOde(0))
  if nstatus = 0 then
//If nstatus = 0 Then
    ShowMessage('OK');
//MsgBox "ok"
//End If
end;
//End Subprocedure TForm1.Button2Click(Sender: TObject);
//Private Sub Command7_Click()
var
  sss: array[0..20]of Char;
//Dim sss As String * 20
  nstatus: Integer;
  nhiCC: Integer;
begin
  nstatus := read_card(nhiCC, 0, 32, 10, sss);
//nstatus% = read_card(nhiCC, 0, 32, 10, sss)
  if nstatus = 0 then
//If nstatus = 0 Then
    Edit1.Text := sss
//    Text1.Text = sss
  else Edit1.Text := IntToStr(nstatus);
//Else
//    Text1.Text = CStr(nstatus)
//End If
end;
//End Sub

解决方案 »

  1.   

    function read_card(var hiCC: Integer; var zone: Integer; var addr: Integer; var data_len: Integer; dat: PChar): Integer; external 'STICCW32.DLL';
    //Declare Function read_card Lib "STICCW32.DLL" (ByVal hiCC%, ByVal zone%, ByVal addr%, ByVal data_len%, ByVal dat$) As Integer
    function check_code(var hiCC: Integer; var code_length: Integer; code: Byte): Integer; external  'STICCW32.DLL';
    //Declare Function check_code Lib "STICCW32.DLL" (ByVal hiCC%, ByVal code_length%, code As Byte) As Integer
      

  2.   

    function read_card(var hiCC: Integer; var zone: Integer; var addr: Integer; var data_len: Integer; dat: PChar): Integer; external 'STICCW32.DLL'; stdcall;
    //Declare Function read_card Lib "STICCW32.DLL" (ByVal hiCC%, ByVal zone%, ByVal addr%, ByVal data_len%, ByVal dat$) As Integer
    function check_code(var hiCC: Integer; var code_length: Integer; code: Byte): Integer; external  'STICCW32.DLL'; stdcall;
    //Declare Function check_code Lib "STICCW32.DLL" (ByVal hiCC%, ByVal code_length%, code As Byte) As Integer
      

  3.   

    还有一段代码,我自己试着写不行,请帮助我
    Declare Function write_card Lib "STICCW32.DLL" (ByVal hiCC%, ByVal zone%, ByVal addr%, ByVal data_len%, ByVal dat$) As IntegerPrivate Sub Command8_Click()
    Dim sTmp As String
    sTmp = Trim(Text7.Text)
    nstatus% = write_card(nhiCC, 0, 32, 10, sTmp)
    If nstatus = 0 Then
    MsgBox "OK!"
    Else
    MsgBox "error!"
    End If
    end sub
    出错的原因在于不知sTmp变量为什么类型?以及dll文件函数中的dat为何类型?