Vc++ OFN_ALLOWMULTISELECT CFileDialog

cs_pichu Messages postés 28 Date d'inscription dimanche 9 mars 2003 Statut Membre Dernière intervention 8 juin 2005 - 25 mars 2003 à 18:11
tonicorp Messages postés 1 Date d'inscription dimanche 13 février 2005 Statut Membre Dernière intervention 13 février 2005 - 13 févr. 2005 à 15:34
je comprends pas ce que je doit faire avec m_ofn.lpstrFile dans l'extrait de la msdn quand je veux recuperer plusieurs chemins de fichiers :
To allow the user to select multiple files, set the OFN_ALLOWMULTISELECT flag before calling DoModal. You need to supply your own filename buffer to accommodate the returned list of multiple filenames. Do this by replacing m_ofn.lpstrFile with a pointer to a buffer you have allocated, after constructing the CFileDialog, but before calling DoModal. Additionally, you must set m_ofn.nMaxFile with the number of characters in the buffer pointed to by m_ofn.lpstrFile.

Merci de me donner un exemple.

3 réponses

CoreBreaker Messages postés 540 Date d'inscription dimanche 23 mars 2003 Statut Membre Dernière intervention 5 octobre 2007 1
26 mars 2003 à 02:57
Cela surtout à répérer les fichiers selectionnés
Tu alloues un buffer pour receptionner le nom des fichiers selectionnés que tu affectes à m_ofn.lpstrFile.

Core Breaker :)
0
cs_pichu Messages postés 28 Date d'inscription dimanche 9 mars 2003 Statut Membre Dernière intervention 8 juin 2005
26 mars 2003 à 08:57
oui mais comment on alloue un buffer??
il faut declarer quoi pour l'affecté a m_ofn.lpstrFile?
je comprends pas si il faut declarer un char * par exemple..
et affecté son adresse à m_ofn.lpstrFile...(ca ca marche pas)
0
tonicorp Messages postés 1 Date d'inscription dimanche 13 février 2005 Statut Membre Dernière intervention 13 février 2005
13 févr. 2005 à 15:34
Salut,

Utilise les fonction GetStartPosition() et GetNextPathName().

exemple :
CFileDialog fDlg(/* tes paramètre */);

fDgl.DoModal();

POSITION position = fDlg.GetStartPosition();
while (position)
{
CString s = fDlg.GetNextPathName(position);
/* ton traitement avec tes chemin */
}



http://tonicorp.free.fr
0