关于如何调用函数SHFormatDrive的问题我已经按照网上的做法了
在header file加上#if   !defined(SHFMT_OPT_FULL)   
    
  #if   defined   (__cplusplus)   
  extern   "C"   {   
  #endif   DWORD   WINAPI   SHFormatDrive(HWND   hwnd,   
  UINT   drive,   
  UINT   fmtID,   
  UINT   options);   
#define   SHFMT_ID_DEFAULT   0xFFFF   
 #define   SHFMT_OPT_FULL   0x0001   
  #define   SHFMT_OPT_SYSONLY   0x0002   
 #define   SHFMT_ERROR   0xFFFFFFFFL     
  //   drive   may   be   formatable   
  #define   SHFMT_CANCEL   0xFFFFFFFEL   
  #define   SHFMT_NOFORMAT   0xFFFFFFFDL       
  #if   defined   (__cplusplus)   
  }   
  #endif   
  #endif     
跟着在source file内加上BOOL CFormatDriveDlg::OnInitDialog()
{
CDialog::OnInitDialog();
typedef DWORD (WINAPI *PFNSHFORMATDRIVE)(HWND hwnd,UINT drive,UINT fmtID,UINT options); PFNSHFORMATDRIVE SHFormatDrive;automatically
//  when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon

// TODO: Add extra initialization hereHINSTANCE hInstance=LoadLibrary(_T ("E:\\PROJECT\\formatDrive\\Debug\\Shell32.dll")); if (hInstance==NULL) 
AfxMessageBox("false");  SHFormatDrive=(PFNSHFORMATDRIVE)GetProcAddress(hInstance,"SHFormatDrive"); if(SHFormatDrive==NULL) { FreeLibrary(hInstance); return 1; } return TRUE;  // return TRUE  unless you set the focus to a control
}
void CFormatDriveDlg::OnOK() 
{
// TODO: Add extra validation here
                                                                            SHFormatDrive(m_hWnd,0 ,SHFMT_ID_DEFAULT, 0);  FreeLibrary(hInstance); 
    
       }
为什么还不可以???????郁闷