Je cherche un moyen de creer une boite de dialogue parcourir ou juste le treewiev avec la liste des dossier de mon disque:
Je sais qu'il exixte une classe la CDialogFile pour les fichiers je cherche la meme chose pour les repertoires merci
Je cherche un moyen de creer une boite de dialogue parcourir ou juste le treewiev avec la liste des dossier de mon disque:
Je sais qu'il exixte une classe la CDialogFile pour les fichiers je cherche la meme chose pour les repertoires merci
LPITEMIDLIST SHBrowseForFolder(
LPBROWSEINFO lpbi
);
voir sur MSDN pour la documentation complète.
Salut Voici un bout ce code qui fait le bouleau er retien le chemin du repertoire selectioner
la variable CString strTmpPath; est global
Ce bout de code fonctionne bien
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
58
59
60
61
62
63
64
65
66 void CInitControl::OnBrowse() { // TODO: Add your control notification handler code here CString strFolderPath; GetFolder(&strFolderPath, "Sample of getting folder.", this->m_hWnd, NULL, NULL); CEdit *experiment=(CEdit*)GetDlgItem(IDC_EXPERIMENT); experiment->SetWindowText(strFolderPath); } void CInitControl::GetFolder(CString *strSelectedFolder, const char *lpszTitle, const HWND hwndOwner, const char *strRootFolder, const char *strStartFolder) { char pszDisplayName[MAX_PATH]; LPITEMIDLIST lpID; BROWSEINFOA bi; bi.hwndOwner = hwndOwner; if (strRootFolder == NULL) { bi.pidlRoot = NULL; } else { LPITEMIDLIST pIdl = NULL; IShellFolder* pDesktopFolder; char szPath[MAX_PATH]; OLECHAR olePath[MAX_PATH]; ULONG chEaten; ULONG dwAttributes; strcpy(szPath, (LPCTSTR)strRootFolder); if (SUCCEEDED(SHGetDesktopFolder(&pDesktopFolder))) { MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szPath, -1, olePath, MAX_PATH); pDesktopFolder->ParseDisplayName(NULL, NULL, olePath, &chEaten, &pIdl, &dwAttributes); pDesktopFolder->Release(); } bi.pidlRoot = pIdl; } bi.pszDisplayName = pszDisplayName; bi.lpszTitle = lpszTitle; bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT; bi.lpfn = 0; if (strStartFolder == NULL) { bi.lParam = FALSE; } else { strTmpPath.Format("%s", strStartFolder); bi.lParam = TRUE; } bi.iImage = NULL; lpID = SHBrowseForFolderA(&bi); if (lpID != NULL){ BOOL b = SHGetPathFromIDList(lpID, pszDisplayName); if (b == TRUE) { strSelectedFolder->Format("%s",pszDisplayName); } } else { strSelectedFolder->Empty(); } }
ne en moin il contien un probleme d'initialisation de parametre ces pas bien grave et ca ne beure pas de memoire, le message retourner par Rational purified est:
A PAR message indicates that the program called a Win32API or C run-time routine, such as write(), with a bad parameter.[W] PAR: Both Debug and non-Debug versions of CRT are active; This may cause CRT heap operations to fail. {1 occurrence}
Call location
FindResourceExW [KERNEL32.dll]
OpenComponentLibraryOnMemEx [CLBCATQ.DLL]
OpenComponentLibraryOnMemEx [CLBCATQ.DLL]
RtlCharToInteger [ntdll.dll]
RtlCharToInteger [ntdll.dll]
LdrLoadDll [ntdll.dll]
LoadLibraryExA [KERNEL32.dll]
LoadLibraryA [KERNEL32.dll]
CLSIDFromOle1Class [ole32.DLL]
CoTaskMemRealloc [ole32.DLL]
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 J'espere que ca va t'aider ALP
Salut Voici un bout ce code qui fait le bouleau er retien le chemin du repertoire selectioner
la variable CString strTmpPath; est global
Ce bout de code fonctionne bien
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
58
59
60
61
62
63
64
65
66 void CInitControl::OnBrowse() { // TODO: Add your control notification handler code here CString strFolderPath; GetFolder(&strFolderPath, "Sample of getting folder.", this->m_hWnd, NULL, NULL); CEdit *experiment=(CEdit*)GetDlgItem(IDC_EXPERIMENT); experiment->SetWindowText(strFolderPath); } void CInitControl::GetFolder(CString *strSelectedFolder, const char *lpszTitle, const HWND hwndOwner, const char *strRootFolder, const char *strStartFolder) { char pszDisplayName[MAX_PATH]; LPITEMIDLIST lpID; BROWSEINFOA bi; bi.hwndOwner = hwndOwner; if (strRootFolder == NULL) { bi.pidlRoot = NULL; } else { LPITEMIDLIST pIdl = NULL; IShellFolder* pDesktopFolder; char szPath[MAX_PATH]; OLECHAR olePath[MAX_PATH]; ULONG chEaten; ULONG dwAttributes; strcpy(szPath, (LPCTSTR)strRootFolder); if (SUCCEEDED(SHGetDesktopFolder(&pDesktopFolder))) { MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szPath, -1, olePath, MAX_PATH); pDesktopFolder->ParseDisplayName(NULL, NULL, olePath, &chEaten, &pIdl, &dwAttributes); pDesktopFolder->Release(); } bi.pidlRoot = pIdl; } bi.pszDisplayName = pszDisplayName; bi.lpszTitle = lpszTitle; bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT; bi.lpfn = 0; if (strStartFolder == NULL) { bi.lParam = FALSE; } else { strTmpPath.Format("%s", strStartFolder); bi.lParam = TRUE; } bi.iImage = NULL; lpID = SHBrowseForFolderA(&bi); if (lpID != NULL){ BOOL b = SHGetPathFromIDList(lpID, pszDisplayName); if (b == TRUE) { strSelectedFolder->Format("%s",pszDisplayName); } } else { strSelectedFolder->Empty(); } }
ne en moin il contien un probleme d'initialisation de parametre ces pas bien grave et ca ne beure pas de memoire, le message retourner par Rational purified est:
A PAR message indicates that the program called a Win32API or C run-time routine, such as write(), with a bad parameter.[W] PAR: Both Debug and non-Debug versions of CRT are active; This may cause CRT heap operations to fail. {1 occurrence}
Call location
FindResourceExW [KERNEL32.dll]
OpenComponentLibraryOnMemEx [CLBCATQ.DLL]
OpenComponentLibraryOnMemEx [CLBCATQ.DLL]
RtlCharToInteger [ntdll.dll]
RtlCharToInteger [ntdll.dll]
LdrLoadDll [ntdll.dll]
LoadLibraryExA [KERNEL32.dll]
LoadLibraryA [KERNEL32.dll]
CLSIDFromOle1Class [ole32.DLL]
CoTaskMemRealloc [ole32.DLL]
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 J'espere que ca va t'aider ALP
Salut Voici un bout ce code qui fait le bouleau er retien le chemin du repertoire selectioner
la variable CString strTmpPath; est global
Ce bout de code fonctionne bien
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
58
59
60
61
62
63
64
65
66 void CInitControl::OnBrowse() { // TODO: Add your control notification handler code here CString strFolderPath; GetFolder(&strFolderPath, "Sample of getting folder.", this->m_hWnd, NULL, NULL); CEdit *experiment=(CEdit*)GetDlgItem(IDC_EXPERIMENT); experiment->SetWindowText(strFolderPath); } void CInitControl::GetFolder(CString *strSelectedFolder, const char *lpszTitle, const HWND hwndOwner, const char *strRootFolder, const char *strStartFolder) { char pszDisplayName[MAX_PATH]; LPITEMIDLIST lpID; BROWSEINFOA bi; bi.hwndOwner = hwndOwner; if (strRootFolder == NULL) { bi.pidlRoot = NULL; } else { LPITEMIDLIST pIdl = NULL; IShellFolder* pDesktopFolder; char szPath[MAX_PATH]; OLECHAR olePath[MAX_PATH]; ULONG chEaten; ULONG dwAttributes; strcpy(szPath, (LPCTSTR)strRootFolder); if (SUCCEEDED(SHGetDesktopFolder(&pDesktopFolder))) { MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szPath, -1, olePath, MAX_PATH); pDesktopFolder->ParseDisplayName(NULL, NULL, olePath, &chEaten, &pIdl, &dwAttributes); pDesktopFolder->Release(); } bi.pidlRoot = pIdl; } bi.pszDisplayName = pszDisplayName; bi.lpszTitle = lpszTitle; bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT; bi.lpfn = 0; if (strStartFolder == NULL) { bi.lParam = FALSE; } else { strTmpPath.Format("%s", strStartFolder); bi.lParam = TRUE; } bi.iImage = NULL; lpID = SHBrowseForFolderA(&bi); if (lpID != NULL){ BOOL b = SHGetPathFromIDList(lpID, pszDisplayName); if (b == TRUE) { strSelectedFolder->Format("%s",pszDisplayName); } } else { strSelectedFolder->Empty(); } }
ne en moin il contien un probleme d'initialisation de parametre ces pas bien grave et ca ne beure pas de memoire, le message retourner par Rational purified est:
A PAR message indicates that the program called a Win32API or C run-time routine, such as write(), with a bad parameter.[W] PAR: Both Debug and non-Debug versions of CRT are active; This may cause CRT heap operations to fail. {1 occurrence}
Call location
FindResourceExW [KERNEL32.dll]
OpenComponentLibraryOnMemEx [CLBCATQ.DLL]
OpenComponentLibraryOnMemEx [CLBCATQ.DLL]
RtlCharToInteger [ntdll.dll]
RtlCharToInteger [ntdll.dll]
LdrLoadDll [ntdll.dll]
LoadLibraryExA [KERNEL32.dll]
LoadLibraryA [KERNEL32.dll]
CLSIDFromOle1Class [ole32.DLL]
CoTaskMemRealloc [ole32.DLL]
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 J'espere que ca va t'aider ALP
Merci je vais tester toutes ces solutions
Bonne Année A tous
Boggalow![]()
Partager