Page 1 of 1

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

Posted: Sun Oct 08, 2006 8:22 am
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..........

Posted: Sun Oct 08, 2006 9:21 am
by madshi
Is the exe UPX compressed? Updating resources in compressed exes doesn't work properly.