文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>WTL-Open file dialog of new vista/win7 style

WTL-Open file dialog of new vista/win7 style

时间:2010-09-17  来源:wudong

最新的WTL库中添加了对Vista/Win7新风格文件对话框API的封装,使用起来非常方便。

1.选择文件对话框:

//#include <atldlgs.h>
COMDLG_FILTERSPEC filterSpecs[] = 
{
    {_T("Text documents(*.txt)"),_T("*.txt")},
    {_T("MS Word documents(*.doc|*.docx)"),_T("*.doc;*.docx")},
    {_T("All documents(*.*)"),_T("*.*")}
};
CShellFileOpenDialog fileOpenDlg(
    NULL,
    FOS_FORCEFILESYSTEM|FOS_FILEMUSTEXIST|FOS_PATHMUSTEXIST,
   _T("txt"),
    filterSpecs,
    _countof(filterSpecs));
fileOpenDlg.DoModal(m_hWnd);
CString filePath;
fileOpenDlg.GetFilePath(filePath);
//MessageBox(filePath,_T("File path"),MB_OK|MB_ICONINFORMATION);

2.选择文件夹对话框

CShellFileOpenDialog fileOpenDlg(
    NULL,
    FOS_FORCEFILESYSTEM|FOS_PATHMUSTEXIST|FOS_PICKFOLDERS);
fileOpenDlg.DoModal(m_hWnd);
CString folderPath;
fileOpenDlg.GetFilePath(folderPath);
MessageBox(folderPath,_T("Folder path"),MB_OK|MB_ICONINFORMATION);
相关阅读 更多 +
排行榜 更多 +
瓢虫少女

瓢虫少女

飞行射击 下载
潜艇鱼雷

潜艇鱼雷

飞行射击 下载
网络掠夺者

网络掠夺者

飞行射击 下载