| 187 | } |
| 188 | |
| 189 | void RunFileDialog(CComboBox& cCombo, bool bMustExist) |
| 190 | { |
| 191 | CFileDialog cd( true, NULL, NULL, (bMustExist?OFN_FILEMUSTEXIST:0)|OFN_ENABLESIZING, |
| 192 | "Windows CE (*.nb1)|*.nb1|" |
| 193 | "ROM update files (*.nbf)|*.nbf|" |
| 194 | "BIN Flash files (*.bin)|*.bin|" |
| 195 | "SD card images (*.img)|*.img|" |
| 196 | "All files (*.*)|*.*||" ); |
| 197 | |
| 198 | TCHAR szCurDir[1024]; szCurDir[0]=0; |
| 199 | |
| 200 | CString curfile; |
| 201 | cCombo.GetWindowText(curfile); |
| 202 | |
| 203 | if (curfile.IsEmpty()) |
| 204 | { |
| 205 | if (GetCurrentDirectory(1024, szCurDir)) { |
| 206 | cd.m_pOFN->lpstrInitialDir= szCurDir; |
| 207 | } |
| 208 | } |
| 209 | else { |
| 210 | cd.m_pOFN->lpstrInitialDir= curfile; |
| 211 | } |
| 212 | if( cd.DoModal()==IDOK ) |
| 213 | { |
| 214 | cCombo.SetCurSel(CB_ERR); |
| 215 | cCombo.SetWindowText(cd.GetPathName()); |
| 216 | } |
| 217 | } |
| 218 | void COSImageToolDlg::OnBnClickedBrowseSourceFile() |
| 219 | { |
| 220 | RunFileDialog(m_cSource, true); |
no test coverage detected