help me please
How to Update (change, add, delete) res into myprog at runtime ?
How to update Res into MyProg at-runtime
I don't think, that you can change youre resources at runtime. But if it's possible , look at http://help.madshi.net/madResUnit.htm
no change in myprog res
///////////////////////
procedure DeleteFrmResource(exeFullPath, ResName: PWideChar);
var update : dword;
begin
update := BeginUpdateResourceW(exeFullPath, false);
if update <> 0 then
try
UpdateResourceW(update, PWideChar(RT_RCDATA), ResName, 0, nil, 0);
finally
EndUpdateResourceW(update, false);
end;
end;
////////////////////////////
procedure TForm1.Button1Click(Sender: TObject);
begin
deleteFrmResource(Pwidechar(exctractfilepath(application.exename)),'TFORM2');
end;
///////////////////////
procedure DeleteFrmResource(exeFullPath, ResName: PWideChar);
var update : dword;
begin
update := BeginUpdateResourceW(exeFullPath, false);
if update <> 0 then
try
UpdateResourceW(update, PWideChar(RT_RCDATA), ResName, 0, nil, 0);
finally
EndUpdateResourceW(update, false);
end;
end;
////////////////////////////
procedure TForm1.Button1Click(Sender: TObject);
begin
deleteFrmResource(Pwidechar(exctractfilepath(application.exename)),'TFORM2');
end;
Your own exe file is locked by Windows while it is running. As a result you can't change it. However, you could do this:
(1) Copy your.exe to your2.exe
(2) Change the resources in your2.exe
(3) Rename your.exe to your.del
(4) Rename your2.exe to your.exe
(5) Restart your program
(6) In the initialization of your program, delete your.del
However, this works only in the NT family and it needs a restart of your program.
(1) Copy your.exe to your2.exe
(2) Change the resources in your2.exe
(3) Rename your.exe to your.del
(4) Rename your2.exe to your.exe
(5) Restart your program
(6) In the initialization of your program, delete your.del
However, this works only in the NT family and it needs a restart of your program.