当前位置: 首页>>代码示例>>C++>>正文


C++ CFileDialog::GetFileName方法代码示例

本文整理汇总了C++中CFileDialog::GetFileName方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileDialog::GetFileName方法的具体用法?C++ CFileDialog::GetFileName怎么用?C++ CFileDialog::GetFileName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFileDialog的用法示例。


在下文中一共展示了CFileDialog::GetFileName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnImportImage

void CImageMgr::OnImportImage()
{
	if( fontGen->GetStatus() != 0 ) return;

	CFileDialog dlg;
	dlg.AddFilter("All files (*.*)", "*.*");
	dlg.AddFilter("Supported image files (*.bmp;*.jpg;*.tga;*.dds;*.png)", "*.bmp;*.jpg;*.tga;*.dds;*.png", true);

	if( dlg.AskForOpenFileName(this) )
	{
		CIconImageDlg iconDlg;
		iconDlg.fileName = dlg.GetFileName();
		iconDlg.id = 0;
		iconDlg.xoffset = 0;
		iconDlg.yoffset = 0;
		iconDlg.advance = 0;

		if( iconDlg.DoModal(this) == IDOK )
		{
			// Create the icon image
			int r = fontGen->AddIconImage(iconDlg.fileName.c_str(), 
			                              iconDlg.id,
										  iconDlg.xoffset,
										  iconDlg.yoffset,
										  iconDlg.advance);
			if( r < 0 )
			{
				MessageBox(hWnd, "Failed to load image file", "File error", MB_OK);
				return;
			}

			RefreshList();
		}
	}
}
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:35,代码来源:imagemgr.cpp

示例2: OnSelectCharsFromFile

void CCharWin::OnSelectCharsFromFile()
{
	if( isGenerating ) return;

	CFileDialog dlg;
	dlg.AddFilter("All files (*.*)", "*.*", true);

	if( dlg.AskForOpenFileName(this) )
	{
		fontGen->SelectCharsFromFile(dlg.GetFileName().c_str());
		int countMissing = fontGen->GetNumFailedChars();
		if( countMissing )
		{
			stringstream s;
			s << countMissing << " characters from the file are not available in the font";

			TCHAR buf[1024];
			ConvertAnsiToTChar(s.str(), buf, 1024);

			MessageBox(hWnd, buf, __TEXT("Warning"), MB_OK);
		}

		UpdateSubsetsSelection();
		Invalidate(FALSE);
	}
}
开发者ID:tomorrow-wakeup,项目名称:Font-Creator-For-Unity3D,代码行数:26,代码来源:charwin.cpp

示例3: OnNewDocument

BOOL CGeorgesEditDocForm::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// User mode ?
	if (theApp.Superuser)
	{
		// Choose a DFN for this form
		string defFilename = theApp.RootSearchPath;
		defFilename += "*.dfn";

		CFileDialog dlgFile (TRUE, "*.dfn", defFilename.c_str (), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, DfnFilter, theApp.m_pMainWnd);
		if (dlgFile.DoModal () == IDOK)
		{
			if (initDocument (dlgFile.GetFileName (), true))
				return TRUE;
		}
	}
	else
	{
		// Get the Dfn name
		CMyMultiDocTemplate *docTemplate = safe_cast<CMyMultiDocTemplate*> (GetDocTemplate ());
		string dfnName;
		docTemplate->getDfnName (dfnName);
		if (initDocument (dfnName.c_str (), true))
			return TRUE;
	}

	return FALSE;
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:31,代码来源:georges_edit_doc.cpp

示例4: OnGfExt

/////////////////////////////////////////////////////////////////////////////
// CCmdGF message handlers
void CCmdGF::OnGfExt() 
{
	UpdateData(TRUE);

	CMainFrame* main;
	main=(CMainFrame*)AfxGetMainWnd();

	CFRTK* face = &((CSoftComputingWndDoc*)main->GetActiveDocument())->m_frtk;
	IPLIMAGE image = ((CSoftComputingWndDoc*)main->GetActiveDocument())->m_image;

	CFileDialog *pDlg = new CFileDialog( TRUE, NULL, NULL, OFN_READONLY, 
		"얼굴모델 *.dat|*.dat|모든파일 *.*|*.*|", NULL );

	if (pDlg->DoModal())
	{
		CString filename = pDlg->GetFileName();

		if (filename != "")
		{
			CFRTKface facecomp;
			facecomp.load(filename);

			face->FRTKgeofeat(image, NULL, m_source, m_result, facecomp);
		}
	}
}
开发者ID:djkimgogo,项目名称:fuzzy-neural-network,代码行数:28,代码来源:CmdGF.cpp

示例5: if

void CDialConfigDec::OnButton2() 
{
	CFile Fichier; // variable fichier 	                                        
	BYTE compnbpar;
	CFileDialog * FileData = new CFileDialog (TRUE,"*.param",NomFichParam,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,"Paramètres (*.param)|*.param|",this);

	if (FileData->DoModal()==IDOK)
	{
		if(FileData->GetFileExt()!="param")
		{
			MessageBox("Le fichier selectionné n'est pas valide!","Erreur",MB_OK|MB_ICONSTOP);
			m_pmc.SetWindowText("*.param");
			ValidPARAM=FALSE;
		}
		else if (Fichier.Open(FileData->GetPathName(), CFile::modeRead))
		{ 
			Fichier.Read(&compnbpar,1);

			if(compnbpar!=NBpar)
			{
				MessageBox("Fichier  "+Fichier.GetFileName()+"  incompatible!","Nombre de paramètres",MB_OK|MB_ICONSTOP);
				m_param.SetWindowText("*.param");
				ValidPARAM=FALSE;
				Fichier.Close(); 
			}
			else
			{
				NomFichParam=FileData->GetPathName();
				m_param.SetWindowText(FileData->GetFileName());
				ValidPARAM=TRUE;
				Fichier.Close();
			}
		}
		else 
		{
			MessageBox("Le fichier  "+FileData->GetFileName()+"  n'existe pas!","Erreur",MB_OK|MB_ICONSTOP);
			ValidPARAM=FALSE;
		}
	}

	m_ok.EnableWindow(ValidPARAM&&ValidPMC);
	m_checkbox.EnableWindow(ValidPARAM&&ValidPMC);
	m_param.EnableWindow(ValidPMC);
	UpdateData(FALSE);
	delete FileData;
}
开发者ID:clemaitre58,项目名称:CRDAorta,代码行数:46,代码来源:DialConfigDec.cpp

示例6: OnButtongenerate

void CDfuFileMgrDlg::OnButtongenerate() 
{
	HANDLE hFile;
	TCHAR szFilters[]=
    "Dfu Files (*.dfu)|*.dfu|All Files (*.*)|*.*||";
	WORD Vid, Pid, Bcd;

	CFileDialog* dlg;
	dlg = new CFileDialog(FALSE,  _T("dfu"), _T("*.dfu"),
					OFN_CREATEPROMPT |OFN_PATHMUSTEXIST |OFN_OVERWRITEPROMPT,
					szFilters, this);

	UpdateData(TRUE);

	if (m_Vid.IsEmpty() || m_Pid.IsEmpty() || m_Bcd.IsEmpty() )
	{
		AfxMessageBox("One of following element is empty. Please fill before continuing...\r\nVID, PID or Bcd Version"); 
		return;
	}
	else if(m_Images.GetSize() == 0)
	{
        AfxMessageBox("Image list is empty. Please select an S19, Hex or bin file"); 
		return;
	}
	if (dlg->DoModal()==IDOK)
	{
		char *dummy;
		Vid=(WORD)strtoul(m_Vid, &dummy, 16);
		Pid=(WORD)strtoul(m_Pid, &dummy, 16);
		Bcd=(WORD)strtoul(m_Bcd, &dummy, 16);

		if (STDFUFILES_CreateNewDFUFile((LPSTR)(LPCSTR)dlg->GetFileName(), &hFile, Vid, Pid, Bcd)==STDFUFILES_NOERROR)
		{
			for (int i=0;i<m_Images.GetSize();i++)
			{
				CString Tmp, Tmp1;
				HANDLE Image=(HANDLE)m_Images.GetAt(i);

				m_ListFiles.GetText(i, Tmp1);
				if (STDFUFILES_AppendImageToDFUFile(hFile, Image)==STDFUFILES_NOERROR)
				{
					Tmp.Format("Success for '%s' !",Tmp1);
					AfxMessageBox(Tmp);
				}
				else
				{
					Tmp.Format("Failure for '%s'...", Tmp1);
					AfxMessageBox(Tmp);
				}
			}
			STDFUFILES_CloseDFUFile(hFile);
		}
	}

	UpdateData(FALSE);
}
开发者ID:tianxq,项目名称:fly_controller,代码行数:56,代码来源:DfuFileMgrDlg.cpp

示例7: OnLoadFontConfiguration

void CCharWin::OnLoadFontConfiguration()
{
	CFileDialog dlg;
	dlg.AddFilter("All files (*.*)", "*.*");
	dlg.AddFilter("BMFont Font config (*.csv)", "*.csv", true);
	dlg.AddFilter("Text (*.txt)", "*.txt");

	if (dlg.AskForOpenFileName(this))
		LoadFontConfig(dlg.GetFileName());
}
开发者ID:tomorrow-wakeup,项目名称:Font-Creator-For-Unity3D,代码行数:10,代码来源:charwin.cpp

示例8: OnFileOpen

void CEasyToonApp::OnFileOpen()
{
	/*this->*/
	static char szFilter[] = "EasyToon Files (*.ezt)|*.ezt|GIF Files (*.gif)|*.gif|All Files (*.*)|*.*||";
	CFileDialog fileDlg ( true, "gif", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_ENABLEHOOK, szFilter);


	if ( fileDlg.DoModal() == IDOK ) this->OpenDocumentFile(fileDlg.GetFileName());

	/*CWinApp::OnFileOpen();*/
}
开发者ID:GraphiXS6,项目名称:EasyToon,代码行数:11,代码来源:EasyToon.cpp

示例9: OnBrowseFont

void CChooseFont::OnBrowseFont()
{
	CFileDialog dlg;
	dlg.AddFilter("Windows font files", "*.fon;*.fnt;*.ttf;*.ttc;*.fot;*.otf;", true);
	if( dlg.AskForOpenFileName(this) )
	{
		TCHAR buf[1024];
		ConvertAnsiToTChar(dlg.GetFileName(), buf, 1024);

		SetDlgItemText(hWnd, IDC_FONTFILE, buf);

		EnumFonts();
	}
}
开发者ID:tomorrow-wakeup,项目名称:Font-Creator-For-Unity3D,代码行数:14,代码来源:choosefont.cpp

示例10: saveOmdDlg

void CColorEyeIDoc::saveOmdDlg(LPCTSTR FileFilter)
{
    CFileDialog aFileDialog (FALSE, "omd", "*.omd", OFN_SHAREAWARE, FileFilter);
    
    int nID = aFileDialog.DoModal();
    if (nID == IDOK)
    {
        saveOmdFile(aFileDialog.GetPathName());
        debugByTxt(aFileDialog.GetPathName());

        SetPathName(aFileDialog.GetPathName());
        SetTitle(aFileDialog.GetFileName());
    
        SetModifiedFlag(FALSE);
    }
}
开发者ID:dwatow,项目名称:ColorEyeI,代码行数:16,代码来源:ColorEyeIDoc.cpp

示例11: OnFilefind

void CSyntaxDlg::OnFilefind() 
{
	CFileDialog dlg
		(
		TRUE, 
		"txt", 
		"*.txt", 
		OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_FILEMUSTEXIST, 
		"Textdateien (*.txt)" 
		);
	if( IDOK == dlg.DoModal() )
	{
		m_strTagPath = dlg.GetPathName();
		GetDlgItem( IDC_SYN_FILENAME )->SetWindowText( dlg.GetFileName() );
		EnableControls( FALSE );
	}
}
开发者ID:yantrabuddhi,项目名称:poesie,代码行数:17,代码来源:SyntaxDlg.cpp

示例12: OnSaveFontConfiguration

void CCharWin::OnSaveFontConfiguration()
{
	CFileDialog dlg;
	dlg.AddFilter("All files (*.*)", "*.*");
	dlg.AddFilter("BMFont Font config (*.csv)", "*.csv", true);
	dlg.AddFilter("Text (*.txt)", "*.txt");

	// Open a SaveAs dialog to get a filename from the user
	if (dlg.AskForSaveFileName(this))
	{
		FILE *file = NULL;
		string path = dlg.GetFileName();
		file = fopen(path.c_str(), "w+");

		if (NULL != file)
		{
			// write the column definitions
			string definitions = "character,image_path,x_offset,y_offset,x_advance,x,y,width,height\n";
			fwrite(definitions.c_str(), 1, definitions.size(), file);
			const map<int, SIconImage *> &IconImages = fontGen->GetIconImageInfo();
			for (map<int, SIconImage *>::const_iterator itr = IconImages.begin(); IconImages.end() != itr; ++itr)
			{
				TCHAR characterT[4] = { 0 };
				characterT[0] = itr->first;
				string character;
				ConvertTCharToAnsi(characterT, character);

				char info[1024] = { 0 };
				int length = sprintf(info, "%s,%s,%d,%d,%d,%d,%d,%d,%d\n", \
					character.c_str(), \
					itr->second->fileName.c_str(), \
					itr->second->xoffset, \
					itr->second->yoffset, \
					itr->second->advance, \
					itr->second->x, \
					itr->second->y, \
					itr->second->width, \
					itr->second->height);
				fwrite(info, 1, length, file);
			}
			fclose(file);
		}
	}
}
开发者ID:tomorrow-wakeup,项目名称:Font-Creator-For-Unity3D,代码行数:44,代码来源:charwin.cpp

示例13: openOmdDlg

void CColorEyeIDoc::openOmdDlg(LPCTSTR FileFilter)
{
    CFileDialog aFileDialog (TRUE, NULL, NULL, OFN_SHAREAWARE | OFN_OVERWRITEPROMPT, FileFilter);
    
    int nID = aFileDialog.DoModal();
    if (nID == IDOK)
    {
//         m_docDNA.Empty();
        m_docRNA.Empty();
        m_docFileHead.Empty();

        openOmdFile(aFileDialog.GetPathName());
        SetPathName(aFileDialog.GetPathName());
        SetTitle(aFileDialog.GetFileName());

        SetModifiedFlag(FALSE);
        UpdateAllViews(NULL);
   }
}
开发者ID:dwatow,项目名称:ColorEyeI,代码行数:19,代码来源:ColorEyeIDoc.cpp

示例14: OnLoadConfiguration

void CCharWin::OnLoadConfiguration()
{
	if( isGenerating ) return;

	CFileDialog dlg;
	dlg.AddFilter("All files (*.*)", "*.*");
	dlg.AddFilter("BMFont config (*.bmfc)", "*.bmfc", true);
	dlg.AddFilter("Text (*.txt)", "*.txt");

	string dir = fontGen->GetLastConfigFile();
	if( dir != GetDefaultConfig() )
	{
		// cut off the filename and last /
		dir = dir.substr(0, dir.find_last_of("/\\"));
		dlg.SetInitialDir(dir.c_str());
	}

	if( dlg.AskForOpenFileName(this) )
		LoadConfig(dlg.GetFileName());
}
开发者ID:tomorrow-wakeup,项目名称:Font-Creator-For-Unity3D,代码行数:20,代码来源:charwin.cpp

示例15: OnRButtonUp

// enable menu for bitmap export with right click
void CTextureCtrl::OnRButtonUp(int cx, int cy)
{
	POINT pt;
	pt.x = cx;
	pt.y = cy;
	ClientToScreen(*this, &pt); 

	HMENU menu=CreatePopupMenu();
	AppendMenu(menu,MF_STRING,IDM_SAVE_AS, _T("&Save as..."));
	UINT msg=TrackPopupMenu(menu,TPM_RETURNCMD | TPM_RIGHTBUTTON | TPM_TOPALIGN | TPM_LEFTALIGN,pt.x,pt.y,0,*this,NULL);

	if(msg==IDM_SAVE_AS)
	{
		CFileDialog dlg;
		dlg.Create(*this,_T("Bitmap image (*.bmp)|*.BMP|All files (*.*)|*.*||"),_T("Save converted texture"),OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT,false);
		if(dlg.DoModal()==IDOK)
		{
			tex_cache.SaveBitmap(dlg.GetFileName());
		}
	}
}
开发者ID:Gemini-Loboto3,项目名称:Dino-Clasher,代码行数:22,代码来源:TextureCtrl.cpp


注:本文中的CFileDialog::GetFileName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。