تشخیص اینکه HARD DISK ما چند درایو دارد.
اما انجا ما از آن tip ها استفاده نکردیم و یک نوآوری و یک روش بسیار جالب به خرج دادیم.
1 - باید یک فایل را در تمام دیسک ها ذخیره کرد و با دستور Try Except آن را کنترل کرد .
* -> چیزهای مورد نیاز : یک Memo . یک Listbox و یک Button
اینم کدش :
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
ListBox1: TListBox;
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function aa(a:integer):string;
begin
if a=1 then
aa:='c';
if a=2 then
aa:='d';
if a=3 then
aa:='e';
if a=4 then
aa:='f';
if a=5 then
aa:='g';
if a=6 then
aa:='h';
if a=7 then
aa:='i';
if a=8 then
aa:='j';
if a=9 then
aa:='k';
if a=10 then
aa:='l';
if a=11 then
aa:='m';
if a=12 then
aa:='n';
if a=13 then
aa:='o';
if a=14 then
aa:='p';
if a=15 then
aa:='q';
if a=16 then
aa:='r';
if a=17 then
aa:='s';
if a=18 then
aa:='t';
if a=19 then
aa:='u';
if a=20 then
aa:='v';
if a=21 then
aa:='w';
if a=22 then
aa:='x';
if a=23 then
aa:='y';
if a=24 then
aa:='z';
end;
procedure TForm1.Button1Click(Sender: TObject);
var i:integer;s:string;
begin
listbox1.Clear;
for i:=1 to 24 do
begin
s:=aa(i);
try
begin
memo1.Lines.SaveToFile(s+':\a.txt');
listbox1.Items.Add(s);
deletefile(s+':\a.txt');
end;
except
continue;
end;
end;
end;
end.