请教一个问题。我用Delphi调用Vc的动态库。在Vc动态库里有一个 int __stdcall InitKey( int com );语句,我调用它怎么内存出错?我是这样调用的:
  function InitKey(In_Com: Shortint): Shortint; overload;              far;External 'KCCardInf.dll'LabEdt_COMValue.Text := IntToStr(InitKey(1));

解决方案 »

  1.   

    具体方法参考
    http://www.programfan.com/showarticle.asp?id=1211
      

  2.   

    你应该说报什么错误啊!
    大哥要不你把shortint改成integer看看
      

  3.   

    DELPHI对应那函数声明要改两处.
    1,加stdcall声明
    2,Shortint改成Integer
      

  4.   

    找不到:mwrf32.dll,这个动态连接库是系统的还是应用程序的啊!?
      

  5.   

    //////////////////////////////////////////////////////////////////////////////////////////////////////////
    // 功能: 取得主钱包的信息
    // 输入参数:
    // com 串口号 0:com1, 1:com2, 2:com3 ...
    // 返回参数:
    // IccID IC卡帐号
    // userName 用户姓名
    // balance 卡片余额
    // amount 最后一次消费金额
    // exchangeSn 卡片交易流水号
    // 返回值:
    // 0 成功
    // 非0 失败(调用GetErrInfo可以获得详细的错误信息)
    //////////////////////////////////////////////////////////////////////////////////////////////////////////
    int __stdcall GetMainPurseInfo( int com, unsigned long* IccID, BYTE* userName, long* balance, short* amount, short* exchangeSn );我在delphi 里怎样调用VC的这个涵数;
      

  6.   

    function GetMainPurseInfo(com :Integer;IccID:PULONG;userName:PByte;balace:PLongint;amount:PShortint;exchangeSn:PShortint):Integer;stdcall;
      

  7.   

    MWRF32.DLL应该是你用那些卡设备带的接口程序吧.
    估计是这儿出的.
    http://www.gzmwiccard.comfunction GetMainPurseInfo(com:Integer;
      var IccID:Cardinal;
      userName:Pchar;
      var balance:Integer;
      var amount:short;
      var exchangeSn:short):Integer;stdcall;
      

  8.   

    ////////////////////////////////////////////////////////////////////////////////////////////
    // 功能: 获取详细的错误信息
    // 输入参数:
    // errCode 函数调用时返回的错误代码  
    // 返回值: 成功 -- 详细的错误信息
    // 失败 -- NULL
    ////////////////////////////////////////////////////////////////////////////////////////////
    char* __stdcall GetErrInfo( int errCode, char* errInfo );
    我在delphi 里怎样调用VC的这个涵数;
      

  9.   


    ////////////////////////////////////////////////////////////////////////////////////////////
    // 功能: 获取详细的错误信息
    // 输入参数:
    // errCode 函数调用时返回的错误代码  
    // 返回值: 成功 -- 详细的错误信息
    // 失败 -- NULL
    ////////////////////////////////////////////////////////////////////////////////////////////
    char* __stdcall GetErrInfo( int errCode, char* errInfo );delphi调用怎么出错!???
      function GetErrInfo(ErrCode: Integer; var ErrInfo: PChar): PChar;
               far; stdcall; external 'KCCardInf.dll';
    这个函数还是出错??
      

  10.   

    char* __stdcall GetErrInfo( int errCode, char* errInfo );
    可以转换成
    function GetErrInfo(errCode:Integer;errInfo:PChar):PChar;严格说,这个函数定义得很不严谨, 呵呵..会让人觉得这公司缺人才..------------------------------------------------
    调用:
    var
      buf:array[0..1000]of char;....  
      FillChar(buf,1000,0);
      
      GetErrInfo(errCode,@buf);
      

  11.   

    var
      ErrorMsg: array[0..1000]of char;
      ErrorCode: integer;
    //  ErrorMsg: PChar;
    begin
      ErrorCode := StrToInt(LabEdt_ErrorCode.Text);
      FillChar(ErrorMsg, 1000, 0);
      GetErrInfo(ErrorCode, @ErrorMsg);
    end;
     这段代码怎么出这样的错误:
    [Error] Uni_ReadCard.pas(154): Types of actual and formal var parameters must be identical