在硬盘里有个EXE,它不运行时候,用程序实现来给它加入(或替换)资源文件,如何做?

CPerlAsm_Lx 2003-08-30 04:02:07
在硬盘里有个EXE,它不运行时候,用程序实现来给它加入(或替换)资源文件,如何做?
...全文
102 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
jingrunx 2003-08-31
  • 打赏
  • 举报
回复
resharker
到“汉化新世纪”去下载

—————————————————————————————————
┏━★━━◆━━★━┓
♂欢|◢CSDN◣|使♂        ▲自由保存帖子,浏览,关注检测
┃迎|◥论坛助手◤|用┃        ▲完善的CSDN客户端工具
┗━☆━━◇━━━☆┛       ▲自动添加签名......

让你更快,更爽,更方便地上CSDN...
http://www.csdn.net/expert/topic/573/573604.xml
http://www.chinaok.net/csdn/csdn.zip
tonylk 2003-08-30
  • 打赏
  • 举报
回复
http://www.tonixsoft.com/index.php?mmenu_id=3&smenu_id=0025
MiniPlayer
tonylk 2003-08-30
  • 打赏
  • 举报
回复
Delphi代码:

function TFormMain.ReplaceMediaRes(SrcFileName:String;MediaFileName:String):Boolean;
var
fs:TFileStream;
buffer:PChar;
hUpdateRes:THandle;
begin
result:=false;
if not FileExists(SrcFileName) then begin
MessageBox(Handle,pchar(SrcFileName+' not exists.'),pchar(Application.Title),MB_ICONERROR);
exit;
end;
if not (FileExists(MediaFileName)) then begin
MessageBox(Handle,pchar(MediaFileName+' not exists.'),pchar(Application.Title),MB_ICONERROR);
exit;
end;
fs:=TFileStream.Create(MediaFileName,fmOpenReadWrite);
try
GetMem(buffer,fs.size);
try
fs.ReadBuffer(buffer^,fs.size);
//begin update resource
hUpdateRes:=BeginUpdateResource(pchar(SrcFileName),false);
if(hUpdateRes=0) then begin
MessageBox(Handle,pchar('Error to begin update resource.'),pchar(Application.Title),MB_ICONERROR);
exit;
end;
//!! the language id can get with GetUserDefaultLangID(), in english system it's 1033.
result:=UpdateResource(hUpdateRes,pchar('PLAYER'),pchar('MEDIA'),1033,buffer,fs.Size);
if not result then begin
MessageBox(Handle,pchar('Error ro update resource'),pchar(Application.Title),MB_ICONERROR);
exit;
end;
if not EndUpdateResource(hUpdateRes,false) then begin
MessageBox(Handle,pchar('Error to end update resource.'),pchar(Application.Title),MB_ICONERROR);
exit;
end;
finally
FreeMem(buffer);
end;
finally
fs.Free;
end;
result:=true;
end;

也可参考:
http://www.tonixsoft.com/index.php?mmenu_id=3&smenu_id=0025
MiniPlayer的完整程序
RamjetZhang 2003-08-30
  • 打赏
  • 举报
回复
UpdateResource(自己去看MSDN)
hong668 2003-08-30
  • 打赏
  • 举报
回复
SCOPEXE吧,这个可以更改资源文件的,

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧