本文整理汇总了C++中CFileDialog::GetFileTitle方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileDialog::GetFileTitle方法的具体用法?C++ CFileDialog::GetFileTitle怎么用?C++ CFileDialog::GetFileTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileDialog
的用法示例。
在下文中一共展示了CFileDialog::GetFileTitle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnBnClickedBtnOpen
void CProfileGraphDlg::OnBnClickedBtnOpen()
{
// TODO: Add your control notification handler code here
static char szFilters[] = "KPG Files (*.kpg)|*.kpg|All Files (*.*)|*.*||";
CFileDialog filedlg (TRUE, "kpg", "*.kpg",
OFN_FILEMUSTEXIST| OFN_HIDEREADONLY, szFilters, this);
if( filedlg.DoModal ()==IDOK )
{
CString pathName = filedlg.GetPathName();
m_GraphDoc.Close();
m_GraphChart.ResetChart();
if ( m_GraphDoc.Open( (LPCSTR)pathName ) )
{
// change the window's title to the opened file's title.
CString fileName = filedlg.GetFileTitle ();
CString captionName;
captionName.Format( "%s FRAME = %d", fileName, m_GraphDoc.GetFrameNumber() );
SetWindowText(captionName);
// fill graph sys info
fillGraphSysInfo();
// fill graph call tree
fillGraphCallTree();
}
}
}
示例2: OnFileImport
void CStorageDoc::OnFileImport () {
CFile fImport;
CFileDialog dlgOpen (true);
// #### TODO: Place here initial directory name taken from configuration structures
dlgOpen.m_ofn.lpstrInitialDir = ".";
dlgOpen.m_ofn.lpstrFilter = "Kontron Elektronik Images (*.img)""\0""*.IMG""\0"
"All supported signle image formats""\0""*.JPG;*.JPEG;*.GIF;*.PNG;*.BMP;*.DIB""\0"
"JPEG Bitmap (*.jpg, *.jpeg)""\0""*.JPG;*.JPEG""\0"
"CumpuServe GIF (*.gif)""\0""*.GIF""\0"
"Prtable Network Graphics (*.png)""\0""*.PNG""\0"
"MS Windows Bitmap (*.bmp, *.dib)""\0""*.BMP;*.DIB""\0";
dlgOpen.m_ofn.nFilterIndex = 1;
// dlgOpen.SetWindowText (theApp.LoadString (IDS_IMPORTSEQ_DLGCAPTION));
if (dlgOpen.DoModal () != IDOK)
return;
// #### TODO: Add support for video formats
// #### TODO: Add support for multi-page tif format
// #### TODO: Create import dialog
// #### TODO: Add progress control on the status bar
uvar32_64 selected;
svar32_64 nImages;
uvar32_64 dwSize = m_nDimX * m_nDimY;
CString strTitle;
BYTE *pbPixels = (BYTE *)aimMemoryCommit (dwSize, "CStorageDoc::OnDocAddImportseq", "pbPixels");
if ((selected = Frames[aimActive].GetActiveImageNo()) == -1)
selected = Images.GetCount () - 1;
theApp.StatusState (IDI_INDICATOR_IMPORT);
if (dlgOpen.m_ofn.nFilterIndex == 1) {
if (!fImport.Open (dlgOpen.GetPathName (), CFile::modeRead | CFile::typeBinary | CFile::shareDenyWrite)) {
MessageBox (theApp.m_pMainWnd->m_hWnd, theApp.LoadString (IDS_IMPORTSEQ_OPENERR), theApp.LoadString (IDS_IMPORTSEQ_DLGCAPTION), MB_OK | MB_ICONERROR);
return;
}
BYTE *pbHeader = new BYTE[0x80];
fImport.Read ( pbHeader, 0x80 );
if (((DWORD*)(pbHeader + 2))[0] != 0xB06D1247) {
MessageBox (theApp.m_pMainWnd->m_hWnd, theApp.LoadString (IDS_IMPORTSEQ_TYPEERR), theApp.LoadString (IDS_IMPORTSEQ_DLGCAPTION), MB_OK | MB_ICONERROR);
return;
}
if (((WORD*)pbHeader)[5] != 0x4321) {
MessageBox (theApp.m_pMainWnd->m_hWnd, theApp.LoadString (IDS_IMPORTSEQ_TYPEERR), theApp.LoadString (IDS_IMPORTSEQ_DLGCAPTION), MB_OK | MB_ICONERROR);
return;
}
if (((WORD*)pbHeader)[3] != m_nDimX || ((WORD*)pbHeader)[4] != m_nDimY || m_nBPP != 8) {
MessageBox (theApp.m_pMainWnd->m_hWnd, theApp.LoadString (IDS_IMPORTSEQ_SIZEERR), theApp.LoadString (IDS_IMPORTSEQ_DLGCAPTION), MB_OK | MB_ICONERROR);
return;
}
nImages = ((WORD*)pbHeader)[6];
theApp.StatusState (IDI_INDICATOR_IMPORT);
while (--nImages >= 0) {
strTitle.Format ("%s #%03d", dlgOpen.GetFileTitle (), ((WORD*)pbHeader)[6] - nImages);
CPicture *pImg = new CPicture (this, strTitle, "");
fImport.Read (pbPixels, dwSize);
pImg->Channels(aimAll).SetBits (pbPixels, dwSize);
Images.Insert (selected++, *pImg);
}
nImages = ((WORD*)pbHeader)[6];
fImport.Close ();
delete [] pbHeader;
aimMemoryRelease (pbPixels, "CStorage::OnDocAddImportseq", "pbPixels");
} else if (dlgOpen.m_ofn.nFilterIndex >= 2) {
CImage image;
image.Load (dlgOpen.GetPathName ());
if (image.GetBPP () != m_nBPP || image.GetHeight () != m_nDimY || image.GetWidth () != m_nDimX) {
MessageBox (theApp.m_pMainWnd->m_hWnd, theApp.LoadString (IDS_IMPORTSEQ_SIZEERR), theApp.LoadString (IDS_IMPORTSEQ_DLGCAPTION), MB_OK | MB_ICONERROR);
return;
}
CPicture *pImg = new CPicture (this, dlgOpen.GetFileTitle (), "");
ubyte *pBits;
if (image.IsDIBSection () && image.GetPitch () < 0)
pBits = (ubyte*)image.GetBits () - (m_nDimY - 1) * m_nDimX;
else
pBits = (ubyte*)image.GetBits ();
pImg->Channels(aimAll).SetBits (pBits, m_nDimX * m_nDimY * m_nBPP / 8);
Images.Insert (selected++, *pImg);
}
theApp.StatusState (0);
}