File saving

  • Thread starter Thread starter Randy
  • Start date Start date
R

Randy

I've used the Save as-dialog, but I don't know how to set it on the
right disk or file type.

Now the path is c:\Documents and settings\mydocuments
but I want c:\Project
and only the .mdb files

thx
 
8) Hi Randy!

I think that I can help you to solve your problem.
With the following lines you can set a file typ filter
and a default path for saving files (or you can try it
with the below mentioned procedure).


CString DefPath = "C:\\MyProject\\default_file_name";
char MyFilter[] = "Access-Files (*.mdb)|*.mdb||"; /*The string before
the

first pipe is the text in

the file type combo-

box.

The string behind

pipe is the filter

itself.*/

CFileDialog MyDialog(false, "*.mdb", DefPath,
OFN_HIDEREADONLY|OVERWRITEPROMT,
MyFilter);

if(MyDialog.DoModal() == IDOK)
{
...
}
------------------------------------------------

The second possibility is to edit the entry in the projects string
table.
There you can edit the entry of IDR_MAINFRAME.

Hope that my subscription was helpful.
 
8) Hi Randy!

I think that I can help you to solve your problem.
With the following lines you can set a file typ filter
and a default path for saving files (or you can try it
with the below mentioned procedure).


CString DefPath = "C:\\MyProject\\default_file_name";
char MyFilter[] = "Access-Files (*.mdb)|*.mdb||"; /*The string before
the first pipe is the text in the file type combobox. The string
behind pipe is the filter itself.*/

CFileDialog MyDialog(false, "*.mdb", DefPath,
OFN_HIDEREADONLY|OVERWRITEPROMT,
MyFilter);

if(MyDialog.DoModal() == IDOK)
{
...
}
------------------------------------------------

The second possibility is to edit the entry in the projects string
table.
There you can edit the entry of IDR_MAINFRAME.

Hope that my subscription was helpful.
 
Bongowrote:
CFileDialog MyDialog(false, "*.mdb", DefPath,
OFN_HIDEREADONLY|OVERWRITEPROMT,
MyFilter);

if(MyDialog.DoModal() == IDOK)
{
...
}

The part I set in Bold, doesn't seem to be recognized by Visual C++.
So now my code is

CFileDialog MyDialog(false, "*.mdb", DefPath,
OFN_HIDEREADONLY, MyFilter);

but I get now the FileDialog twice. :s

And how do you know which file is selected?
 
Back
Top