-
March 10th, 2011, 05:56 AM
#1
Shortcut files not filter from CFileDialog?
Hi all,
i m Using CFileDialog with filter or text file to browse only *.txt files.
but shortcut files are also visible in open file dialog .
please tell me how can i resolve this.
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
-
March 10th, 2011, 07:40 AM
#2
Re: Shortcut files not filter from CFileDialog?
Shortcut files to .txt files? Or what kind of shortcut files do you see?
-
March 10th, 2011, 06:26 PM
#3
Re: Shortcut files not filter from CFileDialog?
Originally Posted by vjshankwar
Hi all,
i m Using CFileDialog with filter or text file to browse only *.txt files.
but shortcut files are also visible in open file dialog .
please tell me how can i resolve this.
thanks in advance.
Please show the code you are using to filter files...no mind readers here.
Jim
ATP BE400 CE500 (C550B-SPW) CE560XL MU300 CFI CFII
"The speed of non working code is irrelevant"... Of course that is just my opinion, I could be wrong.
"Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination are omnipotent. The slogan 'press on' has solved and always will solve the problems of the human race."...Calvin Coolidge 30th President of the USA.
-
March 11th, 2011, 12:11 AM
#4
Re: Shortcut files not filter from CFileDialog?
Code:
CString filter=_T("Text Files(*.txt)|*.txt||");
CFileDialog fileDlg(TRUE, NULL, NULL, OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST,filter);
if (fileDlg.DoModal () == IDCANCEL)
{
return;
}
CString file_Path = fileDlg.GetPathName ();
AfxMessageBox(file_Path);
i locate a folder by CFileDialog here text files are present and some shortcut of .docx and .xlsx are also presents to these are displayed.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
-
March 11th, 2011, 12:44 AM
#5
Re: Shortcut files not filter from CFileDialog?
Your code seems to work fine. I tested it on Win7 with VC++ 2010.
Code:
// CString sFilter( _T("Text Files(*.txt)|*.txt|All Files(*.*)|*.*||" ) );
CString sFilter( _T("Text Files(*.txt)|*.txt||" ) );
static TCHAR szFilter[] = _T("Chart Files (*.xlc)|*.xlc|Worksheet Files (*.xls)|*.xls|Data Files (*.xlc;*.xls)|*.xlc; *.xls|All Files (*.*)|*.*||");
CFileDialog fileDlg(TRUE, NULL, NULL, OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST,sFilter);
if (fileDlg.DoModal () == IDCANCEL)
{
return;
}
CString file_Path = fileDlg.GetPathName ();
-
March 11th, 2011, 01:44 AM
#6
Re: Shortcut files not filter from CFileDialog?
see the code works fine for me too on windows xp with vs 2005.
if you mentioning that folder shortcuts and folder are viewable while only .txt is selected then it cant be done as it by default windows style. *.txt will filter only the files. not folders.
◄◄ hypheni ►►
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|