Parsi Coders

نسخه‌ی کامل: ایجاد کردن فولدر و پاک کردن ان در دلفی
شما در حال مشاهده نسخه آرشیو هستید. برای مشاهده نسخه کامل کلیک کنید.
کد:
Example code : Create a new directory and then remove it
// Full Unit code.
// -----------------------------------------------------------
// You must store this code in a unit called Unit1 with a form
// called Form1 that has an OnCreate event called FormCreate.

unit Unit1;

interface

uses
  SysUtils,   // Unit containing the RemoveDir command
  Forms, Dialogs;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation
{$R *.dfm} // Include form definitions

procedure TForm1.FormCreate(Sender: TObject);
begin
  // Create a new directory in the current directory
  if CreateDir('TestDir')
  then ShowMessage('New directory added OK')
  else ShowMessage('New directory add failed with error : '+
                   IntToStr(GetLastError));

  // Remove this directory
  if RemoveDir('TestDir')
  then ShowMessage('TestDir removed OK')
  else ShowMessage('TestDir remove failed with error : '+
                   IntToStr(GetLastError));
end;

end.