Ejemplo n.º 1
0
void CMainFrame::OnFileOpen() {
  COpenHoldemDoc *pDoc = (COpenHoldemDoc *)this->GetActiveDocument();   
  if (!pDoc->SaveModified()) {
    return;        // leave the original one
  }
	CFileDialog			cfd(true);
  cfd.m_ofn.lpstrInitialDir = "";
  // http://msdn.microsoft.com/en-us/library/windows/desktop/ms646839%28v=vs.85%29.aspx
  cfd.m_ofn.lpstrFilter = "OpenHoldem Formula Files (*.ohf, *.oppl, *.txt)\0*.ohf;*.oppl;*.txt\0All files (*.*)\0*.*\0\0";
	cfd.m_ofn.lpstrTitle = "Select Formula file to OPEN";
	if (cfd.DoModal() == IDOK) {				
		pDoc->OnOpenDocument(cfd.GetPathName());
		pDoc->SetPathName(cfd.GetPathName());
		// Update window title, registry
		p_openholdem_title->UpdateTitle();
		theApp.StoreLastRecentlyUsedFileList();
	}
}
Ejemplo n.º 2
0
void CMainFrame::OnFileOpen()
{
    COpenHoldemDoc *pDoc = (COpenHoldemDoc *)this->GetActiveDocument();

    if (!pDoc->SaveModified())
        return;        // leave the original one

    CFileDialog			cfd(true);

    cfd.m_ofn.lpstrInitialDir = preferences.path_ohf();
    cfd.m_ofn.lpstrFilter = "OpenHoldem Files (.ohf)\0*.ohf\0All files (*.*)\0*.*\0\0";
    cfd.m_ofn.lpstrTitle = "Select Formula file to OPEN";
    if (cfd.DoModal() == IDOK)
    {
        pDoc->OnOpenDocument(cfd.GetPathName());
        pDoc->SetPathName(cfd.GetPathName());
        // Update window title, registry
        SetMainWindowTitle(cfd.GetFileTitle() + " - " + CString(MAKEINTRESOURCE(AFX_IDS_APP_TITLE)));
        preferences.SetValue(k_prefs_path_ohf, cfd.GetPathName());
    }
}