一个小例子
SaveDialog1.Title := '报盘文件另存为:';
if DiskSize(Ord('A')-$40) = -1 then //软驱中没有软盘
begin
SaveDialog1.InitialDir := gSysPath;
end
else begin //软驱中有软盘
SaveDialog1.InitialDir := 'A:\';
end;
SaveDialog1.Filter := 'Zip files (*.zip)|*.zip';
SaveDialog1.Title := '报盘文件另存为:';
if DiskSize(Ord('A')-$40) = -1 then //软驱中没有软盘
begin
SaveDialog1.InitialDir := gSysPath;
end
else begin //软驱中有软盘
SaveDialog1.InitialDir := 'A:\';
end;
SaveDialog1.Filter := 'Zip files (*.zip)|*.zip';
解决方案 »
- 关于TChart或者TDBChart和数据库的连接,请教高手
- 这个原因也会导致,"无法更新定位行.一些值在最后读取的时候已更改.",不知道大家知道么?? 怎么解决,大家出个点子.
- float 字段保存問題
- 如何实现不存盘编译
- 在模拟鼠标点击的时候如何控制鼠标按键按下的时间?
- 如何用Delphi开发PhotoShop的滤镜
- 请问如何获取并口数据
- 一个控件的问题。应该很简单,本人不会用,请大哥们帮帮小弟。
- 我在win2000,office200下开发的程序..........
- 大专生何去何从
- 诚恳的问:怎样用Delphi向数据库中存储BLOB呢,请大家说一下自己的看法。答者有分了!!!
- 万分火急,请大家帮帮忙!
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; function DiskInDrive(const Drive: char): Boolean;var
Form1: TForm1;implementation{$R *.DFM}function DiskInDrive(const Drive: char): Boolean;
var
DrvNum: byte;
EMode: Word;
begin
result := false;
DrvNum := ord(Drive);
if DrvNum >= ord('a') then dec(DrvNum,$20);
EMode := SetErrorMode(SEM_FAILCRITICALERRORS); Try
if DiskSize(DrvNum-$40) <> -1 then
begin
result := true;
//if Messagebox(0,'错误提示!','[A:\]驱动器中的磁盘已准备好!!!',
mb_iconinformation+mb_YesNO) = idYes then
Messagebox(0,'[A:\]驱动器中的磁盘已准备好!!!','错误提示!',
mb_iconinformation+mb_OK);
end else
Messagebox(0,'请向[A:\]驱动器中插入磁盘!!!','错误提示!',
mb_iconinformation+mb_OK);//原来的代码messagebeep(0);
Finally
SetErrorMode(EMode);
End;end;procedure TForm1.Button1Click(Sender: TObject);
begin
DiskInDrive('a');
end;end.
COPY文件
copyfile('c:\msdos.sys','A:\msdos.sys',true)
2:
function DiskIndrive(const Drive:Char):boolean;
var dn:byte; em:word;
begin
result:=false;
dn:=ord(drive);
if dn>ord('a') then dec(dn,$20);
em:=setErrorMode(SEM_FailCriticalErrors);
try
if disksize(dn-$40)<>-1 then result:=true;
finally
SetErrorMode(em);
end;
end;procedure TForm1.BitBtn1Click(Sender: TObject);
begin
if diskindrive('a') then showmessage('Drive : a Ready')
else showmessage('Drive : a Not ready!');
end;