Fórum Janela de formatacao de Diquete no Win-XP nao abri. #283829

05/06/2005

0

Olá!

Sou Desenv. D7 + IB/FB + DBEpress

Estou com o seguinte problema:

Como acessar a janela de formatação de Disquete no Win-XP

No Win-98 faço assim e funciona:
--------------------------------

IF DirectoryExists(´C:\Windows\Rundll32.exe´) Then
ShellExecute(Application.Handle,Pchar(´Open´),Pchar(´C:\Windows\Rundll32.exe´),Pchar(´Shell32.dll,SHFormatDrive´),Pchar(´C:\Windows´),SW_SHOWNORMAL)


No Win-Xp fiz assim mas a janela não abre.
IF DirectoryExists(´C:\Windows\System32\Rundll32.exe´) Then
ShellExecute(Application.Handle,Pchar(´Open´),Pchar(´C:\Windows\System32\Rundll32.exe´),Pchar(´Shell32.dll,SHFormatDrive´),Pchar(´C:\Windows\System32´),SW_SHOWNORMAL);

A quem responder, desde já meus agradecimentos.

ANT.CARLOS/SP


Ant.carlos/sp

Ant.carlos/sp

Responder

Posts

06/06/2005

Sandra

[quote:cb87004e06=´ANT.CARLOS/SP´]No Win-Xp fiz assim mas a janela não abre.
IF DirectoryExists(´C:\Windows\System32\Rundll32.exe´) Then
ShellExecute(Application.Handle,Pchar(´Open´),Pchar(´C:\Windows\System32\Rundll32.exe´),Pchar(´Shell32.dll,SHFormatDrive´),Pchar(´C:\Windows\System32´),SW_SHOWNORMAL);
[/quote:cb87004e06]
Antonio,

Talvez seja problema no [b:cb87004e06]If[/b:cb87004e06]:
IF DirectoryExists(´C:\Windows\System32\´) Then  <= só até o System32


Uso o WinXP e testei. Porém, abre a janela para [b:cb87004e06]formatar WINDOWS[/b:cb87004e06] (caption da janela); não aparece a indicação para se formatar o disquete e muito menos, opção para se escolher o drive.

Teste também este outro código:
{implementation section}

const
  SHFMT_ID_DEFAULT = $FFFF;
  // Formating options
  SHFMT_OPT_QUICKFORMAT = $0000;
  SHFMT_OPT_FULL = $0001;
  SHFMT_OPT_SYSONLY = $0002;
  // Error codes
  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.Button1Click(Sender: TObject);
begin
  SHFormatDrive(Handle, 0, SHFMT_ID_DEFAULT, SHFMT_OPT_QUICKFORMAT)
end;


Espero que ajude! :D


Responder

Gostei + 0

26/06/2005

Ant.carlos/sp

Olá!
Após várias pesquisas, encontrei um código que abre a Janela de Formatacao de Disquete do Windows.


T+

ANT.CARLOS/SP


Valeu Sandra!



---------------------------------------
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

function SHFormatDrive(Wnd : hWnd; Drive : integer;
Size : uint; Action : integer) : integer; stdcall;
external ´shell32´ name ´SHFormatDrive´;

procedure TForm1.Button1Click(Sender: TObject);
begin
SHFormatDrive(Handle,0,2,1);
end;

end.
---------------------------------------


Responder

Gostei + 0

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar