Solved

How to Format the A:\ Drive ??

Posted on 1998-09-27
1
122 Views
Last Modified: 2012-05-04
Does any Guru know how to :

1) Check if the A:\ drive is formatted

2) If not formatted, format it

I'm using D2
0
Comment
Question by:joshordan
1 Comment
 
LVL 10

Accepted Solution

by:
viktornet earned 200 total points
ID: 1340989
Here is some code.......
-----------
   const
           SHFMT_ID_DEFAULT = $FFFF;
           SHFMT_OPT_QUICKFORMAT = $0000;
           SHFMT_OPT_FULL = $0001;
           SHFMT_OPT_SYSONLY = $0002;
           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
  Code: LongInt;
begin
  Code:= SHFormatDrive(Handle, 0, SHFMT_ID_DEFAULT, SHFMT_OPT_QUICKFORMAT);
  if Code < 0 then
    ShowMessage('Could not format floppy drive');
end;
end.
-----------

Regards,
Viktor Ivanov
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

708 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

10 Experts available now in Live!

Get 1:1 Help Now