请问,在win 95/nt 下怎样自己写程序格式化磁盘。 好分奉送(100分)

  • 主题发起人 主题发起人 div zhang
  • 开始时间 开始时间
<a href="http://202.120.85.61/delphibbs/DispQ.asp?LID=108824>先看看这里</a>
 
为何不看已答问题?<br><br><br>JJlei<br>来自uddf的回答:<br>There is an API hidden away in Shell32.dll called SHFormatDrive, this brings up the standard format removable drive dialog. I stumbled across this in the borland.public.delphi.winapi newsgroup.<br><br>{implementation section}<br>..<br>..<br>const<br>&nbsp; &nbsp; &nbsp; &nbsp; SHFMT_ID_DEFAULT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = $FFFF;<br>&nbsp; &nbsp; &nbsp; &nbsp; // Formating options<br>&nbsp; &nbsp; &nbsp; &nbsp; SHFMT_OPT_QUICKFORMAT &nbsp; = $0000;<br>&nbsp; &nbsp; &nbsp; &nbsp; SHFMT_OPT_FULL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= $0001;<br>&nbsp; &nbsp; &nbsp; &nbsp; SHFMT_OPT_SYSONLY &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = $0002;<br>&nbsp; &nbsp; &nbsp; &nbsp; // Error codes<br>&nbsp; &nbsp; &nbsp; &nbsp; SHFMT_ERROR &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = $FFFFFFFF; <br>&nbsp; &nbsp; &nbsp; &nbsp; SHFMT_CANCEL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= $FFFFFFFE; <br>&nbsp; &nbsp; &nbsp; &nbsp; SHFMT_NOFORMAT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= $FFFFFFFD; <br><br>function SHFormatDrive(Handle: HWND; Drive, ID, Options: Word): LongInt;<br>&nbsp; &nbsp; &nbsp; &nbsp; stdcall; external 'shell32.dll' name 'SHFormatDrive'<br><br>procedure TForm1.btnFormatDiskClick(Sender: TObject);<br>var<br>&nbsp; &nbsp; &nbsp; &nbsp; retCode: LongInt;<br>begin<br>&nbsp; &nbsp; &nbsp; &nbsp; retCode:= &nbsp; &nbsp; &nbsp; SHFormatDrive(Handle, 0, SHFMT_ID_DEFAULT,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SHFMT_OPT_QUICKFORMAT);<br>&nbsp; &nbsp; &nbsp; &nbsp; if retCode &lt; 0 then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ShowMessage('Could not format drive');<br>end;<br><br>end.
 
刚才好象出了些问题,改了改html才发了过去。 &nbsp; &nbsp;:)
 
咦!<br>喔!<br><br>多谢menxin处理了一下,<br>我犯了个大错误,<br>下次小心;)<br><br>
 
谢谢 Menxin
 
后退
顶部