>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:
#DEFINE SHFMT_ERROR 0xFFFFFFFF
#DEFINE SHFMT_CANCEL 0xFFFFFFFE
#DEFINE SHFMT_NOFORMAT 0xFFFFFFFD
#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