Bonjour, Voila une solution que j'ai trouvé en faisant une petite recherche sur le web : déjà tu rajoutes la librairie COMDEF.H #include <COMDEF.H> ensuite cette fonction quelque part dans ton programme : HRESULT CreatePIDL(LPCTSTR pstrPath, LPITEMIDLIST* pItemIDList) { // I'm lazy and used _bstr_t to convert to wide // characters. You'll have to link to comsupp.lib // and #include <comutil.h> _bstr_t bstrPath(pstrPath); LPSHELLFOLDER pShellFolder; HRESULT hr = SHGetDesktopFolder(&pShellFolder); if (SUCCEEDED(hr)) { hr = pShellFolder->ParseDisplayName(NULL, NULL, bstrPath, NULL, pItemIDList, NULL); pShellFolder->Release(); } return hr; } et enfin quand tu initialise ta boite de dialogue : BROWSEINFO bi; .... LPITEMIDLIST pidlRoot; pidlRoot = NULL; CreatePIDL("C:\\Program Files", &pidlRoot); bi.pidlRoot = pidlRoot; .... Voila.... Glipper ps : attention, je crois qu'il faut liberer la mémoire apres l'ouverture d'une telle boite de dialogue : "The calling application is responsible for freeing the returned item identifier list using the shells task allocator. "
|