Si tu utilises les mfc j'ai rien à rajouter à ce t'as dis chadenat sinon en api la fonction fait ce que tu veux :
BOOL OuvrirUnFichier(HWND hWnd, LPTSTR szNomDeFichier)
/* hWnd est le handle de la fénêtre appelante
LPTSTR contiendra le nom du fichier séléctionné*/
{
OPENFILENAME ofn;
char szTmp[MAX_PATH];
ZeroMemory(&ofn, sizeof(ofn));
ZeroMemory(szTmp, sizeof(szTmp));
szTmp[0] = '\0';
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hWnd;
ofn.lpstrFile = szTmp;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrFilter = "extension (*.ext)\0*.ext\0"; /* tu
remplaces par ton extension */
ofn.nFilterIndex = 1;
ofn.lpstrTitle = "Ouverture";
ofn.lpstrInitialDir = NULL;
ofn.lpstrCustomFilter = NULL;
ofn.nMaxCustFilter = 0;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.nFileOffset = 0;
ofn.nFileExtension = 0;
ofn.lpstrDefExt = NULL;
ofn.lCustData = 0;
ofn.lpfnHook = 0;
ofn.lpTemplateName = 0;
ofn.Flags = OFN_PATHMUSTEXIST; /* tu mets les
indicateurs adéquats */
if (!GetOpenFileName(&ofn))
{
return FALSE;
}
lstrcpy(szNomDeFichier, (LPCTSTR)szTmp);
return TRUE;
}