exe is not a valid win32 application ...........!!!

delphi package - madRes, madTools, madStrings, ...
Post Reply
yes_me
Posts: 1
Joined: Sun Oct 08, 2006 8:11 am

exe is not a valid win32 application ...........!!!

Post by yes_me »

Madshi,

i have a big problem here :cry:

when try to change exe icon it change successful but when try to run exe
error message : (.exe is not a valid win32 application) ??

where is the problem in code ??

Code: Select all

function UpdateExeIcon(exeFile, iconGroup, icoFile: string) : boolean;
var resUpdateHandle : dword;
begin
  resUpdateHandle := BeginUpdateResourceW(PWideChar(wideString(exeFile)), false);
  if resUpdateHandle <> 0 then begin
    result := LoadIconGroupResourceW(resUpdateHandle, PWideChar(wideString(iconGroup)), 0, PWideChar(wideString(icoFile)));
    result := EndUpdateResourceW(resUpdateHandle, false) and result;
  end else
    result := false;
end;

 UpdateExeIcon('c:\1.exe', 'MAINICON', 'c:\111.ico');
thank you and sorry for my bad english..........
madshi
Site Admin
Posts: 10749
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Is the exe UPX compressed? Updating resources in compressed exes doesn't work properly.
Post Reply