怎么把dll做成资源再释放? 怎么把dll文件做成资源放在exe工程中,运行exe时释放dll到指定位置?怎么写函数呀??? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://blog.csdn.net/tank77/archive/2007/01/11/1479915.aspx 这个问题问的人太多了,重新正理测试一下:1.先建一文件,如:myrc.rc,内容如下:mydll DLL E:\temp\cdll\cdll.dll前两个随便起,后面是你要加入的DLL名2.将myrc.rc加入工程3.释放程序如下:var h:HRSRC; s:integer; g:HGLOBAL; lp:pointer; t:tmemorystream;begin h := FindResource(0, 'mydll', 'DLL'); if (h=0) then begin ShowMessage('error'); exit; end; s:=SizeofResource(0, h); g:=LoadResource(0,h); lp:=LockResource(g); t:=tmemorystream.Create; t.Position:=0; t.Write(lp^,s); t.SaveToFile('e:\temp\cdll.dll'); t.Position:=0; t.Free; FreeResource(g); 这个没有封装进exe里面吧? 我想的是把dll文件封装进exe,只有一个单独的exe环境,运行exe的时候释放出来. 将myrc.rc加入工程这就是放在Exe中啊。 像这样行不行?mydll.rc文件内容 mydll DLL E:\1.dll批处理转换成res内容 Brccc32.exe mydll.rc转成了mydll.res 再把mydll.res放入exe工程中.代码如下:var h:HRSRC; s:integer; g:HGLOBAL; lp:pointer; t:tmemorystream; begin h := FindResource(0, 'mydll', 'DLL'); if (h=0) then begin ShowMessage('error'); exit; end; s:=SizeofResource(0, h); g:=LoadResource(0,h); lp:=LockResource(g); t:=tmemorystream.Create; t.Position:=0; t.Write(lp^,s); t.SaveToFile('e:\2.dll'); t.Position:=0; t.Free; FreeResource(g); 记录文件的插入、读取、删除 MSComm采集数据 SQL语句错误请教。 如何读取image控件中的图片某点的Alpha值呢?这条语句如何写呢? 在activexform中ado数据库怎样设置,才能让客户端自动连接到WEB服务器? 请问如何解决我调用外部的程序的窗体置顶的问题???? adoconnection动态连接数据库问题 紧急问题,在线等待(2) 急啊!关于TBitmap开启透明后,Canvas颜色变浅问题,能恢复正常吗? 超简单问题 急需能打开DICOM文件的程序啊 TeeChart V7和Delphi自带的TeeChart共存
1.先建一文件,如:myrc.rc,内容如下:
mydll DLL E:\temp\cdll\cdll.dll
前两个随便起,后面是你要加入的DLL名
2.将myrc.rc加入工程
3.释放程序如下:
var
h:HRSRC;
s:integer;
g:HGLOBAL;
lp:pointer;
t:tmemorystream;
begin
h := FindResource(0, 'mydll', 'DLL');
if (h=0) then
begin
ShowMessage('error');
exit;
end;
s:=SizeofResource(0, h);
g:=LoadResource(0,h);
lp:=LockResource(g);
t:=tmemorystream.Create;
t.Position:=0;
t.Write(lp^,s);
t.SaveToFile('e:\temp\cdll.dll');
t.Position:=0;
t.Free;
FreeResource(g);
这个没有封装进exe里面吧? 我想的是把dll文件封装进exe,只有一个单独的exe环境,运行exe的时候释放出来.
这就是放在Exe中啊。
mydll.rc文件内容 mydll DLL E:\1.dll批处理转换成res内容 Brccc32.exe mydll.rc转成了mydll.res 再把mydll.res放入exe工程中.代码如下:
var
h:HRSRC;
s:integer;
g:HGLOBAL;
lp:pointer;
t:tmemorystream;
begin
h := FindResource(0, 'mydll', 'DLL');
if (h=0) then
begin
ShowMessage('error');
exit;
end;
s:=SizeofResource(0, h);
g:=LoadResource(0,h);
lp:=LockResource(g);
t:=tmemorystream.Create;
t.Position:=0;
t.Write(lp^,s);
t.SaveToFile('e:\2.dll');
t.Position:=0;
t.Free;
FreeResource(g);