Thema: Delphi EXE Icon austauschen

Einzelnen Beitrag anzeigen

API

Registriert seit: 18. Apr 2004
637 Beiträge
 
#1

EXE Icon austauschen

  Alt 21. Feb 2008, 09:29
Hallo DP

Ich probiere ein Icon einer fremden EXE auszutauschen und bin auf die
UpdateExeIcon gestossen.

2 Fragen:

- Was genau macht MAKELANGID und welche parameter muss man einsetzen?
Sind die Sprachen abhängig vom Programm oder OS?

- Wie findet man die Bezeichnung für "iconGroup" für das Haupticon der Exe Datei?

Delphi-Quellcode:
Uses madres {resource functions for both NT and 9x families - sourcecode @ madshi.net}

{$R *.res}

function MAKELANGID(sPrimaryLanguage: Word;
  sSubLanguage: Word): Word;
begin
  result := (sSubLanguage shl 10) or sPrimaryLanguage;
end;

function UpdateExeIcon(exeFile, iconGroup, icoFile: string; language: word): boolean;
var resUpdateHandle: dword;
  c: TPIconGroup;
begin
  resUpdateHandle := BeginUpdateResourceW(PWideChar(wideString(exeFile)), false);
  if resUpdateHandle <> 0 then
  begin
    if GetIconGroupResourceW(resUpdateHandle, PWideChar(wideString(iconGroup)), language, c) then
      result := LoadIconGroupResourceW(resUpdateHandle, PWideChar(wideString(iconGroup)), language, PWideChar(wideString(icoFile)))
    else
      if StrToIntDef(iconGroup, -1) > -1 then
        result := LoadIconGroupResourceW(resUpdateHandle, PWideChar(pointer(strtoint(iconGroup))), language, PWideChar(wideString(icoFile)))
      else
        result := false;
    result := EndUpdateResourceW(resUpdateHandle, false) and result;
  end else
    result := false;
end;

begin
  UpdateExeIcon('Project1.exe', 'MainIcon', 'red.ico', makelangid(LANG_German, SUBLANG_GERMAN));
end.
  Mit Zitat antworten Zitat