Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Otros entornos y lenguajes > Lazarus, FreePascal, Kylix, etc.
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

 
 
Herramientas Buscar en Tema Desplegado
  #6  
Antiguo 24-07-2013
chuli17 chuli17 is offline
Miembro
NULL
 
Registrado: feb 2011
Posts: 11
Poder: 0
chuli17 Va por buen camino
Hola buenas aqui esta la funcion buscar, y gracias a todos por responder.

Código Delphi [-]
procedure Buscar(Lista: TStringList; Path, Mascara: String); overload;
var
  SR: TSearchRec;
begin
  Path:= IncludeTrailingPathDelimiter(Path);
  if FindFirst(Path + '*.*', faAnyfile, SR) = 0 then
  repeat
    if (SR.Name <>  '.') and (SR.Name <> '..') then
      if (SR.Attr and faDirectory) = faDirectory then
        Buscar(Lista,Path+SR.Name,Mascara);
  until FindNext(SR) <> 0;
  FindClose(SR);
  if FindFirst(Path + Mascara, faAnyfile, SR) = 0 then
  repeat
    if (SR.Name <>  '.') and (SR.Name <> '..') then
      if (SR.Attr and faDirectory) <> faDirectory then
        Lista.Add(Path + SR.Name);
  until FindNext(SR) <> 0;
  FindClose(SR);
end;

procedure Buscar(Lista: TStringList; Path: String; Mascaras: TStringList); overload;
var
  i: Integer;
begin
  for i:= 0 to Mascaras.Count - 1 do
    Buscar(Lista,Path,Mascaras[i]);
end;


procedure TForm1.FormCreate(Sender: TObject);

var
   drive : Char;
   tipo : Integer;
begin
   for drive:= 'A' to 'Z' do
   begin
      tipo := GetDriveType(PChar(drive+':\'));
      if tipo <> 0 then
       case tipo of
         DRIVE_REMOVABLE: Combobox1.Items.Add(drive + ':\' + '   (Disco Extraible)');
         DRIVE_FIXED: Combobox1.Items.Add(drive + ':\' + '   (Disco Duro)');
         DRIVE_RAMDISK: Combobox1.Items.Add(drive + ':\' + '   (Ram Disk)');
       end;//Case
   end;
   end;

procedure TForm1.Button1Click(Sender: TObject);
var
  Lista: TStringList;
  Mascaras: TStringList;
  s: string;
begin
  Lista:= TStringList.Create;
  try
    Mascaras:= TStringList.Create;
    try
      Mascaras.Add('1.DAT');
      Mascaras.Add('2.DAT');
      Mascaras.Add('3.DAT');
      s:= Copy(Combobox1.Text,1,3);
      if Buscar(Lista,s + 'Nueva carpeta',Mascaras)then // Aqui en esta linea da el error
      begin
      Form2.Show;
      Form2.RichEdit1.Lines.Add(Lista.Text);
      end
else
      ShowMessage('Nada Encontrado');
    finally
      Mascaras.Free;
    end;

  finally
    Lista.Free;
  end;
end;
Responder Con Cita
 


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
ERROR: Data Type mismatch in criteria expression El Mike Conexión con bases de datos 7 01-12-2008 22:22:46
Statement expected, but expression of type 'Boolean' found Shikanda Conexión con bases de datos 7 06-09-2007 13:26:19
Error: Type mismatch in expression gusanita Varios 11 28-01-2006 18:12:17
type mismatch in expression noe SQL 1 12-02-2005 02:41:26
Database Desktop, Type Mismatch Expression en campo fecha fjolivares SQL 1 19-01-2005 13:45:53


La franja horaria es GMT +2. Ahora son las 07:02:49.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi