易截截图软件、单文件、免安装、纯绿色、仅160KB

.net调用delphi写的dll,出错误

错误类型:出错误尝试读取或写入受保护的内存。这通常指示其他内存已损坏。

C#源码
[DllImport("Base64.dll")]
public static extern string Base64ToStr(string Base64);

protected void Page_Load(object sender, EventArgs e)
{
Response.Write(Base64ToStr("YWRtaW4="));
}

delphi 源码unit Base;

interface

uses ShareMem,SysUtils, Classes;

// 将SourceSize长度的源Source编码为Base64字符串返回
function Base64Encode(const Source; SourceSize: Integer): string; overload;
// 将Source从StartPos开始的Size长度的内容源编码为Base64,写入流Dest。Size=0文件结束
procedure Base64Encode(Source, Dest: TStream; StartPos: Int64 = 0; Size: Int64 = 0); overload;
// 把字符串Str编码为Base64字符串返回
function StrToBase64(Str: string): string;stdcall;

// 按给定的编码源Source和长度Size计算并返回解码缓冲区实际所需长度
function Base64DecodeBufSize(const Source; Size: Integer): Integer;
// 将Base64编码字符串Source解码存放在Buf中,返回解码长度
function Base64Decode(const Source: string; var Buf): Integer; overload;
// 将Source从StartPos开始的Size长度的Base64编码内容解码,写入流Dest。Size=0文件结束
procedure Base64Decode(Source, Dest: TStream; StartPos: Int64 = 0; Size: Int64 = 0); overload;
// 把Base64字符串解码为字符串返回
function Base64ToStr(Base64: string): string;stdcall;

implementation

const
  Base64_Ch


相关问答:

delphi動態調用dll的困惑

procedure RunFunction;  
  type  
  TFunc = function(A: Integer): Integer;stdcall; //这里根据DLL里面函数的声明修改  
  var  
  ......

安装了jre6.17后,Delphi不能关闭?

如题, 点击Delphi的File菜单的Exit退出Delphi, Delphi部分关闭--即不能再操作Delphi,但任务栏和进程里,Delphi还在运行,没有真正的退出。是不是安装了jre改变了某些环境变量导致,请问高手如何解决? 注:没安装 ......

delphi activx 的问题 110分

我在网上找了个关于IEBHO的代码,然后按照哪个设置了,后来运行的时候出现
构建
  [警告] Project2.dpr(14): File not found: 'MYbho.TLB'
  [警告] Project2.dpr(16): File not found: 'MYbho.RES' ......

delphi activx 的问题 110分

我在网上找了个关于IEBHO的代码,然后按照哪个设置了,后来运行的时候出现 
[错误] Unit1.pas(15): Undeclared identifier: 'GetTypeInfoCount'
[错误] Unit1.pas(15): Undeclared identifier: 'GetTypeInfo ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号