这个问题不知道难不难?

computerstarveling 2004-07-24 07:48:29
我想让点击我的程序几对硬盘完全格式化,应该怎么做?
...全文
89 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhouhua206 2004-07-28
  • 打赏
  • 举报
回复
对啊,谁身边有人新装机子的试试看啊
fishbone210 2004-07-28
  • 打赏
  • 举报
回复
谁刚买机子的可以什么也不装,就装Delphi,然后运行一次这段代码试试看吧,呵呵

试完了别忘了发个结果上来哦,我很想知道结果,呵呵……
computerstarveling 2004-07-27
  • 打赏
  • 举报
回复
To linzhengqun:
按照你的代码,你是格式化C盘吧。
IFindit 2004-07-26
  • 打赏
  • 举报
回复
这东西还不好测试,哈哈哈....
linzhengqun 2004-07-26
  • 打赏
  • 举报
回复
你想知道,可以试试,反正我是不敢的了,
所以不知道。

结贴吧,最近好多人不结贴,我
唉,我总在说这一句话。
computerstarveling 2004-07-26
  • 打赏
  • 举报
回复
楼上的朋友,请问这样做能完全格式化,数据不能恢复了吗?
linzhengqun 2004-07-25
  • 打赏
  • 举报
回复
关于格式化磁盘
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.

{implementation section}

..

..

const

SHFMT_ID_DEFAULT = $FFFF;

// Formating options

SHFMT_OPT_QUICKFORMAT = $0000;

SHFMT_OPT_FULL = $0001;

SHFMT_OPT_SYSONLY = $0002;

// Error codes

SHFMT_ERROR = $FFFFFFFF;

SHFMT_CANCEL = $FFFFFFFE;

SHFMT_NOFORMAT = $FFFFFFFD;

function SHFormatDrive(Handle: HWND; Drive, ID, Options: Word): LongInt;

stdcall; external 'shell32.dll' name 'SHFormatDrive'

procedure TForm1.btnFormatDiskClick(Sender: TObject);

var

retCode: LongInt;

begin

retCode:=SHFormatDrive(Handle, 0, SHFMT_ID_DEFAULT,SHFMT_OPT_QUICKFORMAT);

if retCode < 0 then

ShowMessage('Could not format drive');

end;

end.

也可以用下面的方法调用:

procedure TForm1.Button1Click(Sender: TObject);

begin

ShellExecute(Application.Handle,

PChar('Open'),

PChar('C:.exe'),

PChar('Shell32.dll,SHFormatDrive'),

PChar('C:'),

SW_SHOWNORMAL);

end;



computerstarveling 2004-07-25
  • 打赏
  • 举报
回复
我确实有必要讲一下我的动机。
有个家伙在我的电脑上干了很不道义的事,虽然说我的粗心也有一定的责任,可是那位老兄也不用那样(具体的作法不想说了),所以我想对他的笔记本电脑来一个报复,虽说冤冤相报何时了,可是真的要发泄一下。
linzhengqun 2004-07-24
  • 打赏
  • 举报
回复
不好吧,,。算了不说
飞天揽月 2004-07-24
  • 打赏
  • 举报
回复
你可以传递参数
长弓落日 2004-07-24
  • 打赏
  • 举报
回复
难!哈哈

目的不纯,会也不告诉你~
飞天揽月 2004-07-24
  • 打赏
  • 举报
回复
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, FileCtrl;

type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
DriveComboBox1: TDriveComboBox;
procedure Button1Click(Sender: TObject);
function Formatdisk(drive:Char):boolean;
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
function SHFormatDrive(hWnd:HWND;Drive,fntID,Options:WORD):longint;stdcall;external'shell32.dll';
implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
Formatdisk(DriveComboBox1.Drive);
end;
function Tform1.Formatdisk(drive:Char):boolean;
var
wDrive:WORD;
rtcode:longint;
begin
wdrive:=ord(UpCase(drive))-ord('A');
rtcode:=SHFormatDrive(application.Handle,wDrive,$ffff,0);
if rtcode=-1 then
result:=false;
result:=true;
end;

end.
sxtdxvb 2004-07-24
  • 打赏
  • 举报
回复
在windows下是不能格式化系统盘的。

就算你把其他盘都格式化了,系统盘还是要到DOS下格式化

那样的话,被害人还是会发现的

1,183

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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