View Single Post
  #1  
Old 14-09-2023, 07:23
BLACKFIRE69's Avatar
BLACKFIRE69 BLACKFIRE69 is offline
Registered User
 
Join Date: Mar 2019
Location: In the Hell
Posts: 699
Thanks: 486
Thanked 2,603 Times in 572 Posts
BLACKFIRE69 is on a distinguished road
Quote:
Originally Posted by audiofeel View Post
@BLACKFIRE69

Is it impossible to get an icon to display by the icon index?
wGetSysDefaultIcons2

something like this...

%SystemRoot%\System32\SHELL32.dll, -123


Code:
{ ResIconSize }
const
  RIS_SMALL                     = $0001;  //  16 x 16
  RIS_MEDIUM                    = $0002;  //  32 x 32
  RIS_LARGE                     = $0003;  //  48 x 48
  RIS_EXTRA_LARGE               = $0004;  //  64 x 64
  RIS_EXTRA_EXTRA_LARGE         = $0005;  // 128 x 128
  RIS_JUMBO                     = $0006;  // 256 x 256


function wGetSysDefaultIconsFromResLib(const AModule: WideString;
  AIndex, RISIcoSize: Cardinal; const Buffer: PAnsiChar; var Count: Cardinal): Integer;

function wGetSysDefaultIconsFromResLib2(const AModule, AOutFile: WideString;
  AIndex, RISIcoSize: Cardinal): Boolean;

function wGetSysDefaultIconsSizeFromResLib(const AModule: WideString;
  AIndex, RISIcoSize: Cardinal): Integer;
Code:
{ GetSysDefaultIcons }
  AModule   := 'C:\Windows\SystemResources\imageres.dll.mun';

  AIndex[1] := 31;  // C-Drive
  AIndex[2] := 27;  // OtherDrvs
  AIndex[3] := 103; // Music
  AIndex[4] := 105; // Desktop
  AIndex[5] := 175; // Donwloads
  AIndex[6] := 107; // Documents

  P := 0; Q := 0;

  for i := 1 to C_RANGE do
  begin
    if i = (C_RANGE div 2) + 1  {i =4} then
    begin
      P := 0; Q := 160;
    end;

    AImage[i].FCreate(FMXForm.Handle);
    AImage[i].SetBounds(NSX(P + 130), NSY(Q + 80), NSX(100), NSY(100));

  #ifdef AMethod1   /* Extract SysDefaultIcons into a Buffer, then load them into AImage[i]   */
    ImgSize[i] := wGetSysDefaultIconsSizeFromResLib(AModule, AIndex[i], RIS_EXTRA_EXTRA_LARGE);
    if ImgSize[i] <> -1 then
    begin
      SetLength(Buffer[i], ImgSize[i]);
      if wGetSysDefaultIconsFromResLib(AModule, AIndex[i], RIS_EXTRA_EXTRA_LARGE, Buffer[i], Count[i]) <> -1 then
        AImage[i].LoadPictureFromBuffer(Buffer[i], Count[i], wmTileStretch);
    end;
  #else             /* Extract SysDefaultIcons into the TmpDir, then load them into AImage[i] */
    ImgFile[i] := ExpandConstant('{tmp}\') + IntToStr(i) + '.png';
    if wGetSysDefaultIconsFromResLib2(AModule, ImgFile[i], AIndex[i], RIS_EXTRA_EXTRA_LARGE) then
    begin
      AImage[i].LoadPicture(ImgFile[i], wmTileStretch);
    end;
  #endif

    P := P + 150;
  end;
  { GetSysDefaultIcons }

.

Last edited by BLACKFIRE69; 14-07-2024 at 02:07.
Reply With Quote
The Following 3 Users Say Thank You to BLACKFIRE69 For This Useful Post:
audiofeel (14-09-2023), hitman797 (14-09-2023), Lord.Freddy (14-09-2023)
Sponsored Links