为了账号安全,请及时绑定邮箱和手机立即绑定

关于MFC图片切换问题

关于MFC图片切换问题

C++
慕盖茨4494581 2018-07-16 11:27:01
怎样读取本地路径下的所有图片(bmp),在MFC上有按钮“”上一张”和“下一张”点一下就切换下一张,萌新求大佬指点!
查看完整描述

2 回答

?
慕婉清6462132

TA贡献1804条经验 获得超2个赞

以获取D:\test目录下所有bmp文件路径为例
void BrowseCurrentAllFile(CString strDir)

{

if (strDir == _T(""))

{

return;

}

else

{

if (strDir.Right(1) != _T("\"))

strDir += L"\";

strDir = strDir + _T("*.bmp");

}

CFileFind finder;

CString strPath;

BOOL bWorking = finder.FindFile(strDir);

while (bWorking)

{

bWorking = finder.FindNextFile();

strPath = finder.GetFilePath();

if (finder.IsDirectory() && !finder.IsDots())

BrowseCurrentAllFile(strPath); //递归调用

else if (!finder.IsDirectory() && !finder.IsDots())

{

//strPath就是所要获取的文件路径

//m_List.AddString(strPath);

}

}

}

调用方式:
BrowseCurrentAllFile(_T("D:\test"));


查看完整回答
反对 回复 2018-07-27
  • 2 回答
  • 0 关注
  • 1000 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信