someone knows a format function or unit for format a hard disk (without using c:\format d:) ????

someone knows a format function or unit for format a hard disk (without using c:\format d:)  ????

i need a function or unit i dont cake about the size or if is it a control.
i just need a funtion to format hard drives.

i will thank any help.
becoolnikeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

illusion_chaserCommented:
From torry site: http://www.swissdelphicenter.ch/torry/showcode.php?id=226
Another link from about site: http://delphi.about.com/od/beginners/l/aa070699.htm

// formating a floppy drive, harddisk, or another drive
// Eine Diskette, Harddisk oder ein anderes Laufwerk formatieren

{
  The SHFormatDrive API provides access to the Shell's format
  dialog box. This allows applications that want to format disks to bring
  up the same dialog box that the Shell uses for disk formatting.
}

const
  SHFMT_DRV_A = 0;
  SHFMT_DRV_B = 1;
  SHFMT_ID_DEFAULT = $FFFF;
  SHFMT_OPT_QUICKFORMAT = 0;
  SHFMT_OPT_FULLFORMAT = 1;
  SHFMT_OPT_SYSONLY = 2;
  SHFMT_ERROR = -1;
  SHFMT_CANCEL = -2;
  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);
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
    ShowMessage('Error Occured!');
  end;
end;


{
  Normally, if a diskette is not in the drive when SHFormatDrive is called,
  the system displays a critical error dialog box that asks the user
  to Abort, Retry, or Ignore.
  You can prevent the system from displaying this dialog box by calling
  the SetErrorMode API with SEM_FAILCRITICALERRORS.
}

var
  EMode: Word;
begin
  EMode := SetErrorMode(SEM_FAILCRITICALERRORS);
  // ShFormatDrive Code....
  SetErrorMode(EMode);
end;

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.