2011년 3월 8일 화요일

MFC FileImport

void CXXXDoc::OnFileImport()
{
 // TODO: Add your command handler code here
 TCHAR currentPath[MAX_PATH];
 GetCurrentDirectory(MAX_PATH, currentPath);

 LPCTSTR szFilter = _T("XML Files (*.xml)|*.xml|All Files (*.*)|*.*|");
 CFileDialog fileDialog(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter);

 fileDialog.m_ofn.lpstrTitle = _T("Open XML Scene File");
 fileDialog.m_ofn.lpstrInitialDir = _T("");

 if (fileDialog.DoModal() == IDOK)
 {
  CString fileExt = fileDialog.GetFileExt();
  CString pathName = fileDialog.GetPathName();

  IGameImporter import;
  import.DoImport(pathName);
 }

 SetCurrentDirectory(currentPath);
}

댓글 없음: