void CMainFrame::OnFileOpen() { CFileDialog* p_fileOpenDlg = new CFileDialog(TRUE,"dat","*.dat", OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,"Data Files (*.dat)|*.dat|All Files (*.*)|*.*||"); if (p_fileOpenDlg->DoModal() != IDCANCEL) { CString filename = p_fileOpenDlg->GetPathName(); FIO_Status file_error = Set_Input_Filename(filename); if (file_error) { char err_str[256]; char temp_err_str[256]; sprintf(err_str,"Error:\n"); Get_File_Error_String(file_error,temp_err_str); strcat(err_str, temp_err_str); AfxMessageBox(err_str,MB_OK | MB_ICONEXCLAMATION); Close_Input_File(); } else { CFileProcDlg* p_fileProcDlg = new CFileProcDlg(); p_fileProcDlg->Set_Current_Directory(current_dir); p_fileProcDlg->SetFormat ( (geodetic_hemiFlag == NSEW) ? TRUE : FALSE, (geodetic_format != DD) ? TRUE : FALSE, (geodetic_format == DMS) ? TRUE : FALSE); Use_NSEW( (geodetic_hemiFlag == NSEW) ? TRUE : FALSE); Use_Minutes( (geodetic_format != DD) ? TRUE : FALSE); Use_Seconds( (geodetic_format == DMS) ? TRUE : FALSE); if (p_fileProcDlg->DoModal() != IDCANCEL) { CFileDialog* p_fileSaveDlg = new CFileDialog(FALSE,"dat","*.dat",OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,"Data Files (*.dat)|*.dat|All Files (*.*)|*.*||"); if (p_fileSaveDlg->DoModal() != IDCANCEL) { filename = p_fileSaveDlg->GetPathName(); if (Set_Output_Filename(filename)) { AfxMessageBox("Error opening output file.",MB_OK | MB_ICONEXCLAMATION); Close_Input_File(); } else { Progress* p_Progress = new Progress(this); if (p_Progress->DoModal() == IDCANCEL) { Close_Input_File(); Close_Output_File(); } delete p_Progress; } } else Close_Input_File(); delete p_fileSaveDlg; } else Close_Input_File(); delete p_fileProcDlg; } } delete p_fileOpenDlg; }
JNIEXPORT void JNICALL Java_geotrans_jni_JNIFiomeths_JNICloseInputFile(JNIEnv *env, jobject obj) { Close_Input_File(); }