ディスクフォーマットダイアログを表示する(Win9x や NT4.0 以降)
ヘッダファイルもないので以下のプロトタイプ宣言も必要
DWORD WINAPI SHFormatDrive(HWND hWnd, UINT drive, UINT fmdID, UINT options);
typedef DWORD (WINAPI *SHFormatDrivePROC)(HWND hWnd, UINT drive, UINT fmdID, UINT options);
void Cxxx::Format(void)
{
HINSTANCE hInst = ::LoadLibrary(_T("shell32.dll"));
if (!hInst)
return;
SHFormatDrivePROC lpDllFunc = (SHFormatDrivePROC)::GetProcAddress((HMODULE)hInst, _T("SHFormatDrive"));
if (!lpDllFunc)
{
::FreeLibrary(hInst);
return;
}
DWORD dRet = (lpDllFunc)(GetSafeHwnd(), 0x0, 0xFFFF, 0x0); // A:ドライブ, ,通常
::FreeLibrary(hInst);
}
hWnd NULL不可
drive 0=a: 1=b: ....
fmdID 0xFFFF で固定
option 0=通常 1=クイック 2=起動用