|
-
April 15th, 2004, 05:03 AM
#16
Originally posted by Jeab.
For "PathFileExists", is the syntax OK :
if (PathFileExists(csFileName) == TRUE)
{
// Do smthg
}
The calling of this function might not be good cause "Undeclared identifier"...
Do you have an idea ?
-
April 15th, 2004, 05:13 AM
#17
Do you ever read MSDN?
PathFileExists
Determines if a file exists.
BOOL PathFileExists(
LPCTSTR pszPath
);
Parameters
pszPath
Address of the file to verify.
Return Values
Returns TRUE if the file exists, or FALSE otherwise.
Example
.............
Requirements
Version 4.71 and later of Shlwapi.dll
Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with Internet Explorer 4.0 or later).
Windows 95/98: Requires Windows 98 (or Windows 95 with Internet Explorer 4.0 or later).
Header: Declared in shlwapi.h.
Import Library: shlwapi.lib.
It means :
a) you must have Internet Explorer 4.0 or later;
b) you must "#include shlwapi.h";
c) you must add shlwapi.lib in your Link "Objecl/Library modules..." settings;
-
April 15th, 2004, 07:24 AM
#18
How to recover the address where the files are saved ?
I use this code to open a CfileDialog for "Save as". And I want to see the ".mpg" files:
CFileDialog cfDlg(FALSE, NULL, m_csPCFileName, OFN_NOCHANGEDIR | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_EXPLORER, "*.MPG ", NULL);
But I can't see them...
Last edited by Jeab.; April 15th, 2004 at 08:19 AM.
-
April 15th, 2004, 08:19 AM
#19
-
April 15th, 2004, 08:28 AM
#20
try this:
Code:
CFileDialog cfDlg(FALSE, NULL, m_csPCFileName, OFN_NOCHANGEDIR | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_EXPLORER, "Mpg Files (*.MPG)|*.MPG| ", NULL);
PS: Please read MSDN. You are not at least trying here !
-
April 15th, 2004, 08:30 AM
#21
I use this code to open a CfileDialog for "Save as". And I want to see the ".mpg" files:
CFileDialog cfDlg(FALSE, NULL, m_csPCFileName, OFN_NOCHANGEDIR | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_EXPLORER, "*.MPG ", NULL);
But I can't see them...
I am forced to repeat: Do you ever read MSDN?
........
The lpszFilter parameter is used to determine the type of filename a file must have to be displayed in the file list box. The first string in the string pair describes the filter; the second string indicates the file extension to use. Multiple extensions may be specified using ‘;’ as the delimiter. The string ends with two ‘|’ characters, followed by a NULL character. You can also use a CString object for this parameter.
For example, Microsoft Excel permits users to open files with extensions .XLC (chart) or .XLS (worksheet), among others. The filter for Excel could be written as:
static char BASED_CODE szFilter[] =
"Chart Files (*.xlc)|*.xlc|Worksheet Files (*.xls)|*.xls|Data Files (*.xlc;*.xls)|*.xlc; *.xls|All Files (*.*)|*.*||";
In your case filter could look like:
Code:
szFilter[] =_T("MPG Files (*.MPG)|*.MPG|All Files (*.*)|*.*||");
-
April 15th, 2004, 09:43 AM
#22
... or only:
CFileDialog cfDlg(FALSE, NULL, m_csPCFileName, OFN_NOCHANGEDIR | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_EXPLORER, _T("MPG Files (*.mpg)|*.mpg||") );
There is no need to declare that static variable.
-
April 15th, 2004, 10:22 AM
#23
Thank's it works weel...
Sorry fot all these questions. I've one last:
How is it possible to recover the file path from which the application is executed ?
-
April 15th, 2004, 10:28 AM
#24
Check out GetModuleFileName API
-
April 15th, 2004, 10:42 AM
#25
Thank's for all of the informations you gave me
You really helped me.
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
|