Fórum Onde estão os icones??? #240022

28/06/2004

0

lá pelas tantas, meu programa precisa exibir o nome de alguns arquivos e pastas num listbox..... dai eu sai dando printscreen no windows catando uns icones para colocar nesses elementos do listbox, cada um referente a sua extenção..... mas agora eu tenho uns 500 bmps, de onde meu prog. puxa os icones...

naum em como puxa-los direto do windows ou dos arquivos...???

valew...


::d::a::m::m::i::t::

::d::a::m::m::i::t::

Responder

Posts

28/06/2004

Beppe

unit Main;

interface

uses
  Windows, Forms, Menus, StdCtrls, Buttons, ComCtrls, Controls, ExtCtrls,
  Classes, SysUtils, Messages, ShellApi, ImgList;

type
  TSearchForm = class(TForm)
...
  end;

var
  SearchForm: TSearchForm;

implementation

{$R *.DFM}

procedure TSearchForm.ProcessSearch(FileInfo: TSearchRec);
var
  Siz: Integer;
  Str: String;
begin
...
  with lvFoundList.Items.Add, FileInfo do
  begin
    Caption := Name;
    Data := Pointer(Siz);
    ImageIndex := GetShellImageEx(FCurrentPath + Name, $4003);
    if Siz = -1 then SubItems.Add(´´) else SubItems.Add(FormatBytes(Siz));
    SHGetFileInfo(Pointer(FCurrentPath + Name), 0, Self.FileInfo, SizeOf(FileInfo),
      SHGFI_TYPENAME);
    SubItems.Add(Self.FileInfo.szTypeName);
    SubItems.AddObject(DateTimeToStr(FileDateToDateTime(Time)), TObject(Time));
    SubItems.Add(ExtractRelativePath(Names.Folder, FCurrentPath));
  end;
  Inc(DesktopInfo.Count);
end;

procedure TSearchForm.FormCreate(Sender: TObject);
var
  ImgList: HIMAGELIST;
begin
  ImgList := SHGetFileInfo(nil, 0, FileInfo, SizeOf(TSHFileInfo),
    SHGFI_SYSICONINDEX or SHGFI_SMALLICON);
  SendMessage(lvFoundList.Handle, LVM_SETIMAGELIST, LVSIL_SMALL, ImgList);
  ImgList := SHGetFileInfo(nil, 0, FileInfo, SizeOf(FileInfo),
    SHGFI_SYSICONINDEX or SHGFI_LARGEICON);
  SendMessage(lvFoundList.Handle, LVM_SETIMAGELIST, LVSIL_NORMAL, ImgList);
end;

end.



Responder

Gostei + 0

28/06/2004

::d::a::m::m::i::t::

nossa... eu soh fiz uma perguntinha e tu me responde com uma super produção... heheheh

valew cara....


Responder

Gostei + 0

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar