![]() |
|
#1
|
|||
|
|||
![]() Как вытащить иконку из реестра?
Делаю так но не работает: Код:
function GetRegistryIconHandle(FileName: string): HICON; var R: TRegistry; Alias, //псевдвним для расширения в реестре IconPath: string; //путь для файла с иконкой IconNum, //номер иконки в файле QPos: Integer; //позиция запятой в записи реестра begin IconNum := 0; R := TRegistry.Create; try R.RootKey := HKEY_CLASSES_ROOT; if R.OpenKey('\' + ExtractFileExt(FileName), True) then Alias := R.ReadString(''); R.CloseKey; if R.OpenKey('\' + Alias + '\DefaultIcon', True) then IconPath := R.ReadString(''); R.CloseKey; QPos := Pos(',', IconPath); if QPos <> 0 then begin IconNum := StrToInt(Copy(IconPath, QPos + 1, 4)); IconPath := Copy(IconPath, 1, QPos - 1) end; finally R.Free; end; Result := ExtractIcon(hInstance, PChar(IconPath), IconNum); end; |