Exporting File function
#1
بسم الله الرحمن الرحيم
ارفقت ملف مصدري Source code يحتوي على Unit متسقلة و Project مثال لعمل Export مباشرة من الــ Executable file .

بالتوفيق Smile

ملف FileExporting.pas ---------------------

PHP كود :
(*
FileExporting unit for Educational use
Coded By STRELiTZIA 03/20/2008
---
You can change code and use it WITHOUT REMOVE MY NAME :)
--
your Action "OnClick Button" for exemple...
 
Code to Call : ExportFile('MyFile.txt', 'MyFile', 'TEXTFILE')
*)
unit FileExporting;
interface
uses
  Classes
, SysUtils, Forms;
 
procedure ExportFile(FileToExport, ResName, ResType: string);
implementation
procedure ExportFile
(FileToExport, ResName, ResType: string);
var 
path: string;
  
Res: TResourceStream; (* <<-- Classes unit *)
begin
  path 
:= ExtractFilePath(* <<-- SysUtils unit *)(Application.ExeName(* <<-- Forms unit *));
  
Res := TResourceStream.Create(0, PChar(ResName), PChar(ResType));
  
Res.SaveToFile(path + FileToExport);
  
Res.Free;
end;
end. 

ملف MainFrm.pas --------------------------

PHP كود :
unit MainFrm;
interface
uses
  Windows
, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  
Dialogs, StdCtrls;
type
  TMain 
= class(TForm)
    
ExportBtn: TButton;
    
procedure ExportBtnClick(Sender: TObject);
  private
    { 
Déclarations privées }
  public
    { 
Déclarations publiques }
  
end;
var
  
Main: TMain;
implementation
{$R *.dfm}
(* 
______________________________________________*)
{
$R FileExport.res}
uses FileExporting, XpMan;
procedure TMain.ExportBtnClick(Sender: TObject);
begin
  ExportFile
('MyFile.txt', 'MYFILE', 'TEXTFILE');
  (* 
Test if Sucess Exporting *)
  if 
FileExists(ExtractFilePath(Application.ExeName) + 'MyFile.txt') then
    ShowMessage
('SUCESS : [File Exported Successfully]') else
    
ShowMessage('ERROR : [Nothing Exported]')
end;
(* 
______________________________________________*)
end. 


الملفات المرفقة
.rar   FileExportTest.rar (الحجم : 152.1 ك ب / التحميلات : 743)
الرد


الردود في هذا الموضوع
Exporting File function - بواسطة STRELiTZIA - 20-03-2008, 07:32 PM
Exporting File function - بواسطة djug - 13-12-2008, 11:28 AM
Exporting File function - بواسطة nabilkeb - 14-12-2008, 11:23 PM
Exporting File function - بواسطة STRELiTZIA - 15-12-2008, 11:56 AM
Exporting File function - بواسطة Ahmed18 - 27-02-2009, 01:12 AM
Exporting File function - بواسطة محمد عبد العزيز - 27-02-2009, 09:19 AM
Exporting File function - بواسطة TF6M - 27-02-2009, 10:54 AM
Exporting File function - بواسطة mohfa - 01-03-2009, 11:27 AM
Exporting File function - بواسطة STRELiTZIA - 01-03-2009, 11:58 AM
Exporting File function - بواسطة wesamnet - 10-03-2009, 02:14 PM

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


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