Parsi Coders
ایجاد کردن فولدر و پاک کردن ان در دلفی - نسخه قابل چاپ

+- Parsi Coders (http://parsicoders.com)
+-- انجمن: Software Development Programming (http://parsicoders.com/forumdisplay.php?fid=37)
+--- انجمن: Pascal/Delphi (http://parsicoders.com/forumdisplay.php?fid=45)
+---- انجمن: Delphi (http://parsicoders.com/forumdisplay.php?fid=69)
+---- موضوع: ایجاد کردن فولدر و پاک کردن ان در دلفی (/showthread.php?tid=518)



ایجاد کردن فولدر و پاک کردن ان در دلفی - Amin_Mansouri - 07-10-2011

کد:
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.