Thread overview | ||||||
---|---|---|---|---|---|---|
|
July 31, 2002 file extension when saving | ||||
---|---|---|---|---|
| ||||
How do I set up the common save dialog to deal with multiple filters? I want it to append the proper extension to the file when saving. I'm using this: BOOL GetFileNameSave(char *filename, int len, HWND hWnd) { OPENFILENAME ofn; ZeroMemory(&ofn, sizeof(OPENFILENAME)); //Zero out the memory for the filename info ofn.lStructSize = sizeof(OPENFILENAME); //Size of the structure ofn.hwndOwner = hWnd; //Window that is calling this if(nUID>=2000) { ofn.lpstrFilter = ("HackMaster Files (*.hmf)\0*.hmf\0HTM Files (*.htm)\0*.htm\0HTML Files (*.html)\0*.html\0"); //Filters } if(nUID<2000) { ofn.lpstrFilter = ("HTM Files (*.htm)\0*.htm\0HTML Files (*.html)\0*.html\0"); //Filters } ofn.lpstrFile = filename; //Where to store it ofn.nMaxFile = len; //Tell it how big the char array is ofn.lpstrTitle = ("Save a File"); //Title ofn.Flags = OFN_HIDEREADONLY|OFN_PATHMUSTEXIST; //Any flags here return GetSaveFileName(&ofn); //Display dialog box } Steve De Chellis |
July 31, 2002 Re: file extension when saving | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steve & Denise De Chellis Attachments: | See if you can used the attached files.
Good luck!
Jan
Steve & Denise De Chellis wrote:
> How do I set up the common save dialog to deal with multiple filters? I want it to append the proper extension to the file when saving.
>
> I'm using this:
>
> BOOL GetFileNameSave(char *filename, int len, HWND hWnd)
> {
> OPENFILENAME ofn;
>
> ZeroMemory(&ofn, sizeof(OPENFILENAME)); //Zero out the memory for the
> filename info
> ofn.lStructSize = sizeof(OPENFILENAME); //Size of the structure
> ofn.hwndOwner = hWnd; //Window that is calling this
> if(nUID>=2000)
> {
> ofn.lpstrFilter = ("HackMaster Files (*.hmf)\0*.hmf\0HTM Files
> (*.htm)\0*.htm\0HTML Files (*.html)\0*.html\0"); //Filters
> }
> if(nUID<2000)
> {
> ofn.lpstrFilter = ("HTM Files (*.htm)\0*.htm\0HTML Files
> (*.html)\0*.html\0"); //Filters
> }
> ofn.lpstrFile = filename; //Where to store it
> ofn.nMaxFile = len; //Tell it how big the char array is
> ofn.lpstrTitle = ("Save a File"); //Title
> ofn.Flags = OFN_HIDEREADONLY|OFN_PATHMUSTEXIST; //Any flags here
>
> return GetSaveFileName(&ofn); //Display dialog box
> }
>
> Steve De Chellis
|
August 01, 2002 Re: file extension when saving | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jan Knepper | Unfortunately for me I do not use classess much in this program. I was hoping their was something simple that I would use in OPENFILENAME that would automaticaly use the appropriate extension based on the current filter selection. Steve De Chellis "Jan Knepper" <jan@smartsoft.cc> wrote in message news:3D486A5B.B791F5CA@smartsoft.cc... > See if you can used the attached files. > Good luck! > Jan > > > > Steve & Denise De Chellis wrote: > > > How do I set up the common save dialog to deal with multiple filters? I want > > it to append the proper extension to the file when saving. > > > > I'm using this: > > > > BOOL GetFileNameSave(char *filename, int len, HWND hWnd) > > { > > OPENFILENAME ofn; > > > > ZeroMemory(&ofn, sizeof(OPENFILENAME)); //Zero out the memory for the > > filename info > > ofn.lStructSize = sizeof(OPENFILENAME); //Size of the structure > > ofn.hwndOwner = hWnd; //Window that is calling this > > if(nUID>=2000) > > { > > ofn.lpstrFilter = ("HackMaster Files (*.hmf)\0*.hmf\0HTM Files > > (*.htm)\0*.htm\0HTML Files (*.html)\0*.html\0"); //Filters > > } > > if(nUID<2000) > > { > > ofn.lpstrFilter = ("HTM Files (*.htm)\0*.htm\0HTML Files > > (*.html)\0*.html\0"); //Filters > > } > > ofn.lpstrFile = filename; //Where to store it > > ofn.nMaxFile = len; //Tell it how big the char array is > > ofn.lpstrTitle = ("Save a File"); //Title > > ofn.Flags = OFN_HIDEREADONLY|OFN_PATHMUSTEXIST; //Any flags here > > > > return GetSaveFileName(&ofn); //Display dialog box > > } > > > > Steve De Chellis > |
August 01, 2002 Re: file extension when saving | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steve & Denise De Chellis | Well, the class isn't that difficult to use...
Jan
Steve & Denise De Chellis wrote:
> Unfortunately for me I do not use classess much in this program. I was hoping their was something simple that I would use in OPENFILENAME that would automaticaly use the appropriate extension based on the current filter selection.
>
> Steve De Chellis
>
> "Jan Knepper" <jan@smartsoft.cc> wrote in message news:3D486A5B.B791F5CA@smartsoft.cc...
> > See if you can used the attached files.
> > Good luck!
> > Jan
> >
> >
> >
> > Steve & Denise De Chellis wrote:
> >
> > > How do I set up the common save dialog to deal with multiple filters? I
> want
> > > it to append the proper extension to the file when saving.
> > >
> > > I'm using this:
> > >
> > > BOOL GetFileNameSave(char *filename, int len, HWND hWnd)
> > > {
> > > OPENFILENAME ofn;
> > >
> > > ZeroMemory(&ofn, sizeof(OPENFILENAME)); //Zero out the memory for
> the
> > > filename info
> > > ofn.lStructSize = sizeof(OPENFILENAME); //Size of the structure
> > > ofn.hwndOwner = hWnd; //Window that is calling this
> > > if(nUID>=2000)
> > > {
> > > ofn.lpstrFilter = ("HackMaster Files (*.hmf)\0*.hmf\0HTM Files
> > > (*.htm)\0*.htm\0HTML Files (*.html)\0*.html\0"); //Filters
> > > }
> > > if(nUID<2000)
> > > {
> > > ofn.lpstrFilter = ("HTM Files (*.htm)\0*.htm\0HTML Files
> > > (*.html)\0*.html\0"); //Filters
> > > }
> > > ofn.lpstrFile = filename; //Where to store it
> > > ofn.nMaxFile = len; //Tell it how big the char array is
> > > ofn.lpstrTitle = ("Save a File"); //Title
> > > ofn.Flags = OFN_HIDEREADONLY|OFN_PATHMUSTEXIST; //Any flags here
> > >
> > > return GetSaveFileName(&ofn); //Display dialog box
> > > }
> > >
> > > Steve De Chellis
> >
|
Copyright © 1999-2021 by the D Language Foundation