But now I want to modify the icon of compressed (UPX) files. It works, but the files cannot be executed, an AV error is being raised. And, more strange, if I change the icon to the uncompressed file and only THEN i use UPX on that file, tha icon is lost at first refresh (F5) but the file is executed normally without errors.
Here is my code:
Code: Select all
dwH := BeginUpdateResourceW(PWideChar(WideString(Self.labedtSourceFile.Text)), False);
try
if LoadIconGroupResourceW(dwH, RESOURCE_MAIN_ICON, 0, PWideChar(WideString(Self.labedtIconFile.Text))) then
Application.MessageBox('OK!!!', PChar(Application.Title), 0)
else
Application.MessageBox('Error', PChar(Application.Title), 0)
finally
EndUpdateResourceW(dwH, False);
end;
How can you explain the second behaviour? (do I use the wrong code?)
Thanks in advance!