void CVisionTestDlg::OnLoadimages() { char aryFileBuffer[ 16*1024 ]; unsigned int unBufferLen = 16*1024 ; memset( aryFileBuffer, 0, 16*1024 ); CFileDialog ldFile(TRUE, NULL, "", OFN_ALLOWMULTISELECT | OFN_ENABLESIZING , "Images (bmp, jpg, png)|*.bmp;*.jpg;*.png||"); // Set Buffer for the Filenames (this is only necessary because of Mulitselection) ldFile.m_ofn.lpstrFile = aryFileBuffer; ldFile.m_ofn.nMaxFile = unBufferLen; if (ldFile.DoModal() != IDOK) return; CString strPath, strFileName, strFileTitle, strFileExt; POSITION pos; // Clear the list ClearFiles(); // Pick all files and add the to the list pos = ldFile.GetStartPosition(); while (pos != NULL) { strPath = ldFile.GetNextPathName(pos); AddFile( strPath ); } }
void PrProtDialog::OnLbButtonClick(wxCommandEvent& event) { wxFile f; f.Create(fn,1); /*<wx/filefn.h> wxFileName::wxRemoveFile(fn)*/ f.Flush(); ldFile(fn); }
void CVisionTestDlg::OnLoadimagesequence() { int nStartFileExt; CString strFileExt; CString strRoot; int nUnderscorePos; int nNumFramesFound; BOOL bFound; CFileDialog ldFile(TRUE, NULL, "", OFN_ENABLESIZING , "Images (bmp, jpg, png)|*.bmp;*.jpg;*.png||"); if (ldFile.DoModal() != IDOK) return; CString strPath, strFileName, strFileTitle; // Clear the list ClearFiles(); strFileName = ldFile.GetPathName(); nStartFileExt = strFileName.ReverseFind('.') + 1; strFileExt = strFileName.Right(strFileName.GetLength() - nStartFileExt); nUnderscorePos = strFileName.ReverseFind('_'); strRoot = strFileName.Left(nUnderscorePos); // Find the number of available files. nNumFramesFound = 0; do { CFile file; CString strComposite; strComposite.Format("%s_%.3d.%s", strRoot, nNumFramesFound+1, strFileExt); bFound = file.Open( strComposite, CFile::modeRead ); if (bFound) { AddFile(strComposite); nNumFramesFound++; file.Close(); } } while (bFound); }