Buscar

Como formatar disquetes pelo delphi?

Código

Para formatar disquetes usando a API do Windows,
com o Delphi, utilize as seguintes rotinas:


procedure FormatDriveDialog;
begin
ShellExecute(Application.Handle,'Open','C:WindowsRundll32.exe',
'Shell32.dll,SHFormatDrive','C:Windows',SW_SHOWNORMAL);
end;

function SHFormatDrive(hWnd : HWnd; Drive, fmtID, Options : LongInt):longint; stdcall; external 'shell32.dll';

procedure QuietFormatDrive;
const
SHFMT_ID_DEFAULT = $FFFF;
SHFMT_OPT_QUICK = $0000;
SHFMT_OPT_FULL = $0001;
SHFMT_OPT_SYSONLY = $0002;
SHFMT_ERROR = $FFFFFFFF;
SHFMT_CANCEL = $FFFFFFFE;
SHFMT_NOFORMAT = $FFFFFFFD;
begin
case SHFormatDrive(Handle, 0, SHFMT_ID_DEFAULT, SHFMT_OPT_FULL) of
SHFMT_ERROR : ShowMessage('Erro ao formatar');
SHFMT_CANCEL : ShowMessage('Formatação cancelada');
SHFMT_NOFORMAT : ShowMessage('Disco não formatado');
end;
end;
 

Publicidade

Vote na dica




Quantidade de votos: 0 votos
Aceitação: 0%


Detalhes da dica

Categoria: Hardware
Adicionada dia: 26/04/05
Por: Miguel Machado
Visualizada: 1288 vezes

Planeta Delphi - Tudo sobre programação Delphi Planeta Delphi - www.planetadelphi.com.br - Todos os direitos reservados | Copyright 2001-2009