Solved

Formatting A Drive

Posted on 2002-06-17
5
183 Views
Last Modified: 2010-04-04
Hi Guyz,

I need to format a hard drive the quickest way possible, without the user knowing what is happening?

For those people who may think tis is dodgy stuff, read on.

I am writing a little program that starts then hides itself when windows starts.
It then wait's say 10 minutes then calls the number that  my computer is plugged into, if the number is engaged then fine, but if the computer has been stolen and plugged into another phone line  it will ring my number, and when it does I want to Format my hard drive remotely.

That's it..

200 point for the smothest answer..
Andy
0
Comment
Question by:Asw
5 Comments
 
LVL 1

Expert Comment

by:yk030299
ID: 7084816
see Win32 Developer's Reference about DeviceloControl
IOCTL_DISK_SET_DRIVE_LAYOUT     Partitions a disk.
IOCTL_DISK_SET_PARTITION_INFO     Sets the disk partition type.
IOCTL_DISK_VERIFY     Performs logical format of a disk extent.
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 7085102
const SHFMT_DRV_A = 0;
const SHFMT_DRV_B = 1;

const SHFMT_ID_DEFAULT = $FFFF;

const SHFMT_OPT_QUICKFORMAT = 0;
const SHFMT_OPT_FULLFORMAT = 1;
const SHFMT_OPT_SYSONLY = 2;

const SHFMT_ERROR = -1;
const SHFMT_CANCEL = -2;
const SHFMT_NOFORMAT = -3;

function SHFormatDrive(hWnd : HWND;
                       Drive : Word;
                       fmtID : Word;
                       Options : Word) : Longint
   stdcall; external 'Shell32.dll' name 'SHFormatDrive';

procedure TForm1.Button1Click(Sender: TObject);
// formating a floppy drive, or another drive
var
  FmtRes : longint;
begin
  try
    FmtRes:= ShFormatDrive(Handle,
                           SHFMT_DRV_A,
                           SHFMT_ID_DEFAULT,
                           SHFMT_OPT_QUICKFORMAT);
    case FmtRes  of
     SHFMT_ERROR : ShowMessage('Error formatting the drive');
     SHFMT_CANCEL :
       ShowMessage('User canceled formatting the drive');
     SHFMT_NOFORMAT : ShowMessage('No Format')
    else
     ShowMessage(''Disk has been formatted!');
    end;
  except
  end;
end;
0
 
LVL 1

Author Comment

by:Asw
ID: 7091173
Hi ginsonic ,yk,

I need to format the C: drive transparently without any messages, I am looking for a complete solution.

Andy
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 7091661
Sorry, I see now that :(
Thinking ...
0
 
LVL 6

Accepted Solution

by:
Mindphaser earned 0 total points
ID: 7125364
Points refunded per request and moved to PAQ

** Mindphaser - Community Support Moderator **
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now