GeneralPurpose.cpp
资源名称:estereo2.zip [点击查看]
上传用户:fengshi120
上传日期:2014-07-17
资源大小:6155k
文件大小:1k
源码类别:
3D图形编程
开发平台:
C/C++
- #include "stdafx.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- #include "GeneralPurpose.h"
- #include "ThumbnailFileDialog.h"
- BOOL SelectImageFile(CString &FilePath)
- {
- CFileDialog* pFileDlg = new CThumbnailFileDialog(TRUE,"jpg",NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_FILEMUSTEXIST,
- "Image Files (*.jpg;*.jps,*.bmp) |*.jpg;*.jps;*.bmp| All Files (*.*) |*.*||", AfxGetMainWnd() );
- char drive[_MAX_DRIVE];
- char dir[_MAX_DIR];
- char fname[_MAX_FNAME];
- char ext[_MAX_EXT];
- CString FileDir;
- _splitpath( FilePath, drive, dir, fname, ext );
- if(strlen(drive) != 0)FileDir = drive;
- if(strlen(dir) != 0)FileDir += dir;
- pFileDlg->m_ofn.nFilterIndex = 0;
- pFileDlg->m_ofn.lpstrInitialDir = FileDir;
- pFileDlg->m_ofn.lpstrTitle = "Select Image";
- CString InitialFileName = fname;
- lstrcpy(pFileDlg->m_ofn.lpstrFile,InitialFileName);
- BOOL FileSelected = FALSE;
- if(pFileDlg->DoModal() == IDOK)
- {
- FilePath = pFileDlg->GetPathName();
- FileSelected = TRUE;
- }
- delete pFileDlg;
- pFileDlg = NULL;
- return FileSelected;
- }