www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++.windows.32-bits - file extension when saving

↑ ↓ ← "Steve & Denise De Chellis" <dbouton snet.net> writes:
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
Jul 31 2002
↑ ↓ Jan Knepper <jan smartsoft.cc> writes:
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

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

Jul 31 2002
↑ ↓ "Steve & Denise De Chellis" <dbouton snet.net> writes:
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


 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


 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


Jul 31 2002
↑ ↓ → Jan Knepper <jan smartsoft.cc> writes:
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


 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


 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



Jul 31 2002