كيف يمكن الوصول برمجيا الى ملفات swf
#8
سأعطيك آلية البحث عن أي ملف ضمن الجهاز ما عليك إلا أن تعطيه اللحقة وهو يقوم بعمل البقية :
1- الإجرائية الأولى تقوم بعمل بحث عن السوقات الموجودة على جهازك.
2- الإجرائية الثانية تقوم بالبحث عن الملفات ذات اللاحقة المطلوبة :
PHP كود :
unit Unit1;

interface

uses
  Windows
, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  
Dialogs, StdCtrls;

type
  TForm1 
= class(TForm)
    
Button1: TButton;
    
ListBox1: TListBox;
    
procedure RFindFile(const folder: TFileName);
    
procedure Button1Click(Sender: TObject);
  private
    { Private 
declarations }
  public
    { Public 
declarations }
  
end;

var
  
Form1: TForm1;
   
    
spec :string;
implementation

{$R *.dfm}

procedure TForm1.RFindFile(const folder: TFileName);
var
  
SearchRec: TSearchRec;
begin
  
// Locate all matching files in the current
  // folder and add their names to the list
  
if FindFirst(folder + spec, faAnyFile, SearchRec) = 0 then begin
    
try
      
repeat
        
if (SearchRec.Attr and faDirectory = 0) or
           (
SearchRec.Name <> '.') and (SearchRec.Name <> '..') then
          ListBox1
.Items.Add(folder + SearchRec.Name);
      
until FindNext(SearchRec) <> 0;
    
except
      FindClose
(SearchRec);
      
raise;
    
end;
    
FindClose(SearchRec);
  
end;
  
// Now search the subfolders
  
if FindFirst(folder + '*.*', faAnyFile
      
Or faDirectory, SearchRec) = 0 then
  begin
    
try
      
repeat
        
if ((SearchRec.Attr and faDirectory) <> 0) and
           (
SearchRec.Name <> '.') and (SearchRec.Name <> '..') then
          RFindFile
(folder + SearchRec.Name + '\');
      until FindNext(SearchRec) <> 0;
    except
      FindClose(SearchRec);
      raise;
    end;
    FindClose(SearchRec);
  end;
end; // procedure RFindFile inside of FindFile

procedure TForm1.Button1Click(Sender: TObject);
begin
         spec :='
*.txt';
RFindFile('
c:\');
end;
end. 
ستوضع النتائج في list box اللا حقة يجب وضعها في المتحول spec ويجب أن تكون في حالتك *.swf أتمنى لك التوفيق
الرد


الردود في هذا الموضوع
كيف يمكن الوصول برمجيا الى ملفات swf - بواسطة issamdnn - 02-12-2009, 10:58 AM

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم