| 82 | } |
| 83 | |
| 84 | int CFolderDialog::DoModal() |
| 85 | { |
| 86 | int nReturn = IDOK; |
| 87 | |
| 88 | // initialize the result to the starting folder value |
| 89 | m_strFinalFolderName = m_strInitialFolderName; |
| 90 | |
| 91 | ITEMIDLIST* __unaligned piid = NULL; |
| 92 | |
| 93 | // call the shell function |
| 94 | piid = (ITEMIDLIST* __unaligned)::SHBrowseForFolder(&m_bi); |
| 95 | |
| 96 | // process the result |
| 97 | if (piid && ::SHGetPathFromIDList(piid, m_szPath)) |
| 98 | { |
| 99 | m_strFinalFolderName = m_szPath; |
| 100 | nReturn = IDOK; |
| 101 | } |
| 102 | else |
| 103 | { |
| 104 | nReturn = IDCANCEL; |
| 105 | } |
| 106 | |
| 107 | // Release the ITEMIDLIST if we got one |
| 108 | if (piid) |
| 109 | { |
| 110 | LPMALLOC lpMalloc; |
| 111 | VERIFY(::SHGetMalloc(&lpMalloc) == NOERROR); |
| 112 | lpMalloc->Free(piid); |
| 113 | lpMalloc->Release(); |
| 114 | } |
| 115 | |
| 116 | return nReturn; |
| 117 | } |
| 118 | |
| 119 | CString CFolderDialog::GetPathName() const |
| 120 | { |
no outgoing calls
no test coverage detected