本文整理汇总了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();
}
}
}
示例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);
}
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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);
}
示例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());
}
示例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();*/
}
示例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();
}
}
示例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);
}
}
示例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 );
}
}
示例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);
}
}
}
示例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);
}
}
示例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());
}
示例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());
}
}
}