Using lpstrCustomFilter in OPENFILENAME structure 
Author Message
 Using lpstrCustomFilter in OPENFILENAME structure

  I'm trying to customize my File Open dialog to choose a default file
extension, then preserve the last extension chosen by the user. Here's
what I've got:

                m_ofn.lpstrTitle = "Open Image File";
        m_ofn.lpstrInitialDir = m_rDefDir;
        m_ofn.Flags |= OFN_EXPLORER;
        m_ofn.nFilterIndex = 0;
        m_ofn.lpstrFilter =
"BMP\0*.BMP\0DIB\0*.DIB\0DCX\0*.DCX\0JIF\0*.JIF\0JPG\0*.JPG\0PCX\0*.PCX\
0PBM\0*.PBM\0PGM\0*.PGM\0PIC\0*.PIC\0PPM\0*.PPM\0PNG\0*.PNG\0TGA\0*.TGA\
0TIF\0*.TIF\0WPG\0*.WPG\0\0";
        m_ofn.lpstrDefExt = "TIF";
        static LPTSTR szFilter2 = "TIF\0*.TIF\0";
        m_ofn.lpstrCustomFilter = szFilter2;
        m_ofn.nMaxCustFilter = sizeof(szFilter2);

  This code in fact starts out selecting the TIF files for display.
However, the user's selection of another file extension doesn't get
saved to lpstrCustomFilter. What am I missing?

Benjamin Eakin



Mon, 03 Mar 2003 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Problems in saving files by using OPENFILENAME ofn structure

2. OPENFILENAME structure member - lpstrFilter

3. OPENFILENAME structure

4. CFileDialog & OPENFILENAME structure

5. Setting lpstrInitialDir in OPENFILENAME structure

6. Problem using structures in structures

7. Another name for the OPENFILENAME

8. OPENFILENAME multi-selected files

9. Windows 2000 OpenFileName

10. openfilename dialog box

11. OPENFILENAME

12. OpenFileName problem

 

 
Powered by phpBB® Forum Software