这样,我们的资源文件打包成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; |