Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How can I format a disk
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00177270
Message ID:
00177567
Vues:
40
>Hi Jean-René,
>
>>I need to format a disk in the drive a:\. I do not want to use the DOS format from VFP with the run command.
>
>The following API call would display the Windows standard format dialog:

>Set Library To FoxTools Additive
>Declare Integer SHFormatDrive in Shell32.DLL ;
> Integer HWND, Integer Drive, Integer FmtID, Integer Options
>SHFormatDrive( _WhToHwnd(_WMainWind()), 0, 0xFFFF,0)
Hi Christof,

You've been reading the MSDN library again, haven't you?:-) I wish that this had been in the SDK. Anyway, the purpose of my post is to expand a bit on your's, if you don't mind.

You can get the main VFP window from foxtools with MainhWnd(). However, if an SDI app is calling the dialog, _WhTohWnd(_WFindTitl(ThisForm.Caption)) may be required.

In order to find out whether or not the function succeeded, the following might be helpful, and available options:
* Error values
#DEFINE SHFMT_ERROR     0xFFFFFFFF && No disk in the drive and user canceled.
#DEFINE SHFMT_CANCEL    0xFFFFFFFE && User canceled
#DEFINE SHFMT_NOFORMAT  0xFFFFFFFD && This is returned if the drive doesn't exist.
* Options
#DEFINE SHFMT_OPT_FULL     0X0001
#DEFINE SHFMT_OPT_SYSONLY  0X0002
Other notes, if the function succeeded, the value returned is the value of the last successful format ID. The low order word value can be passed to the function to tell it to use the same format ID (rather than SHFMT_ID_DEFAULT 0xFFFF) that it did before.
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform