library RtfString;{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }
uses
Windows,SysUtils,Classes,Forms, RichView, RVEdit, RVStyle;
type r=Array Of byte;
function ReadRtfString(var cbytes:Array Of byte):string;stdcall;
var sm:TMemoryStream;
RVE: TRichViewEdit;
rtf:r;
str:string;
begin sm:=TMemoryStream.create;
sm.SetSize(Sizeof(cbytes));
sm.WriteBuffer( cbytes,Sizeof(cbytes)); RVE.LoadRVFFromStream(sm);
RVE.Format;
sm.Clear;
RvE.SaveRTFToStream(sm,true);
sm.ReadBuffer(rtf,sm.Size);
Move(rtf[0],str[1], Length(rtf));
Result:=str;
end;exports
ReadRtfString index 1;begin
end.
这段代码写来共.net调用,,,RVE提示没初始化,,怎么初始化
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }
uses
Windows,SysUtils,Classes,Forms, RichView, RVEdit, RVStyle;
type r=Array Of byte;
function ReadRtfString(var cbytes:Array Of byte):string;stdcall;
var sm:TMemoryStream;
RVE: TRichViewEdit;
rtf:r;
str:string;
begin sm:=TMemoryStream.create;
sm.SetSize(Sizeof(cbytes));
sm.WriteBuffer( cbytes,Sizeof(cbytes)); RVE.LoadRVFFromStream(sm);
RVE.Format;
sm.Clear;
RvE.SaveRTFToStream(sm,true);
sm.ReadBuffer(rtf,sm.Size);
Move(rtf[0],str[1], Length(rtf));
Result:=str;
end;exports
ReadRtfString index 1;begin
end.
这段代码写来共.net调用,,,RVE提示没初始化,,怎么初始化
解决方案 »
- 如何得到一个dll文件的版本,厂商,最后更新日期等信息?
- DLL中如何获得调用其EXE的进程句柄
- 我想用DELPHI6写一个软件,但是我用啥数据库呢???
- 各位大侠,请问怎样调用帮助文件呀?
- ADOConnection怎样连接设置了密码Access数据库
- 一个有20多个字段的表,应该做成那种类型的报表
- 我看到这里的变了,什么都变了,顺便测试一下人气,我怀疑CSDN的下一步……
- 菜鸟发难之四:几个菜鸟问题,都是菜鸟我这几天学DELPHI时遇到了!大侠们,你们出手的时候到了!
- 如何在程序中动态的往库里添加表,表为Access?
- 数据库文件
- delphi中如何获取未来的日期与时间?
- [开源项目-MyBean轻量级配置框架] 使用MyBean快速搭建分模块的应用程序(主页面的TAB)(DLL-MDI)
str:string;
Result:=str;栈中的变量那来做返回值! 过程结束也就被释放了!
RVE := TRichViewEdit.Create
不应该返回字符串,而是返回字符串的长度,字符串存到接收的缓冲区中