1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
void PSPICE::OnBrowseFile()
{
// Verification qu'une temperature a ete selectionne
CString s_temp1, filename,newfile;
int nmaxt = 10000, n_endf, n_limff;
int num_file_sel = 0;
LPTSTR qf = s_temp1.GetBuffer(nmaxt);
POSITION interf;
//Creation et ouverture de la boite de dialogue de selection d'un fichier
//autorisation a la selection multiple
CFile outfile;
static char BASED_CODE szFilter[] = "Fichiers txt (*.txt)|*.txt|All Files (*.*)|*.*||";
DWORD dwFlags = OFN_ALLOWMULTISELECT|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_PATHMUSTEXIST;
CFileDialog m_dlg(TRUE, _T("txt"), NULL, dwFlags, szFilter, AfxGetMainWnd());
m_dlg.m_ofn.lpstrFile = qf;
m_dlg.m_ofn.nMaxFile = nmaxt;
this->UpdateWindow();
if(m_dlg.DoModal()==IDOK)
{
interf = m_dlg.GetStartPosition();
do{
// lecture du chemin du premier fichier
string4t = m_dlg.GetNextPathName(interf);
//recuperation du nom du fichier
n_endf = string4t.GetLength();
n_limff = string4t.ReverseFind('\\');
filename = string4t.Right(n_endf - n_limff - 1);
MessageBox(filename,"Test",MB_OK);
m_list_files.AddString(filename);
//TODO on renomme le fichier qui est envoyé dans le répertoire
//outfile.Rename(string4t,pszBuffer);
if (CopyFile(string4t,pszBuffer,FALSE)==0)
{
MessageBox("erreurboooo","Test",MB_OK);
}
num_file_sel ++ ;
}while(interf != NULL) ;
}
m_but_go.EnableWindow(true);
m_but_view.EnableWindow(true);
} |
Partager