I want to be able to save the MainIcon group of a file to a .ico, so to start, I'm assuming the name of the main icon group is MAINICON, but I'm having a problem, it seems I need to know the resource language, for example, this doesn't work:
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
var
resUpdateHandle : dword;
begin
resUpdateHandle := BeginUpdateResourceW(PWideChar(wideString('calc.exe')), false);
if resUpdateHandle <> 0 then
begin
SaveIconGroupResourceW(resUpdateHandle, 'SC', 0, 'test.ico');
EndUpdateResourceW(resUpdateHandle, true);
end;
end;
Code: Select all
function MAKELANGID(sPrimaryLanguage : Word;
sSubLanguage : Word) : Word;
begin
result := (sSubLanguage shl 10) or
sPrimaryLanguage;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
resUpdateHandle : dword;
begin
resUpdateHandle := BeginUpdateResourceW(PWideChar(wideString('calc.exe')), false);
if resUpdateHandle <> 0 then
begin
SaveIconGroupResourceW(resUpdateHandle, 'SC', makelangid(LANG_FRENCH,SUBLANG_DEFAULT), 'test.ico');
EndUpdateResourceW(resUpdateHandle, true);
end;
end;
lol it works because I know my calc.exe is in french but I wouldn't normally know this for a file,
so how can I fix this?:/
thx