举手之劳:怎样格式化软盘?

wyj1 2000-02-25 02:34:00
请问在DELPHI程序中怎样格式化软盘?用哪个API?有现成控件吗?
...全文
214 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
zoucaiming 2001-07-15
  • 打赏
  • 举报
回复
VxD or WDM
w102272 2000-02-25
  • 打赏
  • 举报
回复
哈哈,看我的答案!

function SHFormatDrive(hWnd : HWND;Drive, fmtID, Options : WORD) : longint; stdcall; external 'shell32.dll';
function _DiskFormat( const Drive : Char ):string; //对一个可移动驱动器或硬盘驱动器格式化,注意这个函数是非常危险的.
var
wDrive : WORD;
dtDrive : string;
formatretcode:longint;
begin
dtDrive := _DiskDriverType(Upcase(Drive));
if not _OK(dtDrive) then begin
result:=dtDrive+'(DiskFormat)'; exit;
end;
// if it's not a HDD or a FDD then raise an exception
if (not _Contain('可移动',dtDrive)) and (not _Contain('硬盘',dtDrive)) then
result := badresult+'无法格式化一个'+dtDrive
else begin// 进行格式化
wDrive := Ord( UpCase(Drive) ) - Ord( 'A' );
// SHFormatDrive 是一个没有公开的 API 函数调用
formatretcode:=SHFormatDrive( Application.Handle, wDrive, $ffff, 0);
if formatretcode=-1 then result:=badresult+'格式化程序已执行,在格式化中发生错误,返回代码:'+inttostr(formatretcode)
else if formatretcode=-2 then result:=badresult+'格式化程序已执行,用户放弃格式化驱动器:'+Drive
else if formatretcode=6 then result:='格式化程序已执行,完成驱动器:'+Drive+'的格式化'
else result:='格式化程序已执行,返回代码:'+inttostr(formatretcode);
end; // else
end;
zyb 2000-02-25
  • 打赏
  • 举报
回复
有兴趣!
zyb 2000-02-25
  • 打赏
  • 举报
回复
有兴趣!
wlj88888 2000-02-25
  • 打赏
  • 举报
回复
在http://www.nccsoft.com/delphi/中分类统计下的“档案元件”的第2页中有一个TFormat v1.0 作者: Mike Johnson (1998/03/26)
TFormat 是能夠格式化磁碟機的元件.
Format floppy disks in Win32 enviroment. Used undocumented API functions of shell32.dll. (2 kb) 请看看是否可用。
sadpacific 2000-02-25
  • 打赏
  • 举报
回复
关注。
wyj1 2000-02-25
  • 打赏
  • 举报
回复
我在MSDN中翻了半天也没有找到头绪,到底是哪一个嘛?
flywind 2000-02-25
  • 打赏
  • 举报
回复
有专门的API,你可以查一查!
wyj1 2000-02-25
  • 打赏
  • 举报
回复
好像调用SHELL不好控制,如倒底格式化的结果怎么样及出错等
Un1 2000-02-25
  • 打赏
  • 举报
回复
可以调Shell嘛!

5,379

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧