[原创]Delphi中ScriptControl的高级应用(二)[10]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 juwuyi 的 blog

  

这样,我们的资源文件打包成dll就完成了!

下面,我们的工作就是通过dll来读取javascript代码。

 

 

{读取资源文件到一个string变量}

function readresourc():string;

var

   hinst : thandle;

   stream:tresourcestream;

   codestring : tstrings;

begin

   result := '';

   //加载dll

   hinst:=loadlibrary('base64.dll');

   if hinst=0 then exit;

   try

 //读取资源文件

   stream:=tresourcestream.create(hinst,’base64file’,'exefile');

   codestring := tstringlist.create();

   try

             //将资源文件存放到列表里

       codestring.loadfromstream(stream);

            //返回一个字符串

       result := codestring.text;

   finally

       codestring.free;

       stream.free;

   end;

finally

   freelibrary(hinst);

end;

end;

本文关键:[原创]Delphi中ScriptControl的高级应用(二)
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top