From: Krasimir Krastev Subject: Re: Format a Disk with Delphi? Date: 23 Jan 1999 00:00:00 GMT Message-ID: <36A9953B.2EDC2C5A@yahoo.com> Content-Transfer-Encoding: 7bit References: <78bv0b$kln23@forums.borland.com> Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Newsgroups: borland.public.delphi.winapi Leonar Narvaez wrote: > Hi everybody! > > I would know how to format a floppy disk with a format non-FAT. I'm trying > to do this with DeviceIOControl Function (API WINDOWS) but, it seems this > doesn't work in windows95. > > I looking for kind of code in delphi to this, or at less if you can tell me > how to get partition information from a disk, it'd be fine. > > Thanks You can use the ShellAPI funciton ShFormatDrive(). Example: 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); 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; ----------------------------------- btw I'm looking for job in USA/Canada ----------------------------------- e-mail: molesoftware@yahoo.com ICQ: 6756883 HomePage: http://www.omega.bg/userswww/u1149