Fórum Como abrir arquivos num listview usando opendialog #381422
14/07/2010
0
Júnior Sistemas
Curtir tópico
+ 0Posts
14/07/2010
Wilson Junior
procedure butAbrirClick(Sender: TObject); begin if OpenDialog1.Execute then ListaArquivos( ExtractFileDir(OpenDialog1.FileName) ) ; end; function TemAtributo(Attr, Val: Integer): Boolean; begin Result := Attr and Val = Val; end; procedure ListaArquivos(Diretorio: String); var srArquivo: TSearchRec; Retorno: integer; Novo: TListItem; begin ListView1.Clear; if Diretorio[ Length(Diretorio) ] <> '\' then Diretorio := Diretorio + '\' ; Retorno := FindFirst( Diretorio + '\*.*', faAnyFile, srArquivo ); try while Retorno = 0 do begin if (srArquivo.Name <> '.') and (srArquivo.Name <> '..') and (not TemAtributo(srArquivo.Attr, faDirectory) )then begin Novo := ListView1.Items.Add; Novo.Caption := srArquivo.Name; Novo.SubItems.Add( Diretorio + srArquivo.Name ); end ; Retorno := FindNext( srArquivo ); end; finally FindClose( srArquivo ); end; end;
Espero ter colaborado.
Gostei + 0
14/07/2010
Júnior Sistemas
Gostei + 0
14/07/2010
Wilson Junior
procedure butAbrirClick(Sender: TObject); begin if OpenDialog1.Execute then ListaArquivos ; end; procedure ListaArquivos; var x: integer; Novo: TListItem; begin ListView1.Clear; for x := 0 to OpenDialog1.Files.Count - 1 do begin Novo := ListView1.Items.Add; Novo.Caption := ExtractFileName( OpenDialog1.Files[x] ); Novo.SubItems.Add( OpenDialog1.Files[x] ); end end;
Espero ter colaborado.
Gostei + 0
15/07/2010
Júnior Sistemas
Gostei + 0
15/07/2010
Pedro Saraiva.
deem uma olhadinha ai no produto
http://produto.mercadolivre.com.br/MLB-149256966-winphar-2008-sistema-para-farmacias-e-drogarias-_JM
e ente em contato pelo e-mail pedroluissaraiva@yahoo.com.br.!
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)