我需要一个带有额外控制的文件夹浏览器对话框,例如复选框。
程序支持Windows XP,因此使用带有vista风格的CFileDialog和IFileDialogCustomize不适合我:
CFileDialog od(TRUE/*bOpenFileDialog*/, NULL, NULL,
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT , NULL, NULL, 0,
TRUE/*bVistaStyle*/);
IFileDialogCustomize * customDlgPtr = od.GetIFileDialogCustomize();
if ( customDlgPtr != NULL )
{
HRESULT res = customDlgPtr->AddCheckButton(IDC_CUST_TEXT, _T("Include subtree"), FALSE);
customDlgPtr->Release();
}
IFileOpenDialog * openDlgPtr = od.GetIFileOpenDialog();
if ( openDlgPtr != NULL )
{
openDlgPtr->SetOptions(FOS_PICKFOLDERS);
openDlgPtr->Release();
}
od.DoModal();