Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Where Do I Add the Filters used for File->Open?

Where Do I Add the Filters used for File->Open?

Scheduled Pinned Locked Moved C / C++ / MFC
questioncsharpc++delphivisual-studio
11 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J James A Beggs

    Hi there. I have created an MDI program, and I need to know, where do I add the filters used when a user does a File->Open? Sorry if this is an inane question, but I'm used to using Borland C++ Builder, and obviously VS .Net does things differently. Thanks! James A Beggs American Quarter Horse Association Manager of Product Development

    D Offline
    D Offline
    David Crow
    wrote on last edited by
    #2

    Are you using CFileDialog or GetOpenFileName()?

    J 1 Reply Last reply
    0
    • D David Crow

      Are you using CFileDialog or GetOpenFileName()?

      J Offline
      J Offline
      James A Beggs
      wrote on last edited by
      #3

      I, uhm.... dont know? :) I used the wizard to generate an automatic MDI for me, and it set up the parent's menu system and everything. It had a section in the wizard for inputting the file name to open, but I decided to add more to it. The main application class inherits from CWinApp. The wizard automatically created a Message Map that maps its file->open to CWinAPP::OnFileOpen (Man, I feel stupid. I wouldn't think working on something so simple would have been so hard when translating from Borland C++ Builder to VS .Net. I guess C++ Builder's RAD spoiled me :/ ) James A Beggs American Quarter Horse Association Manager of Product Development

      D 1 Reply Last reply
      0
      • J James A Beggs

        I, uhm.... dont know? :) I used the wizard to generate an automatic MDI for me, and it set up the parent's menu system and everything. It had a section in the wizard for inputting the file name to open, but I decided to add more to it. The main application class inherits from CWinApp. The wizard automatically created a Message Map that maps its file->open to CWinAPP::OnFileOpen (Man, I feel stupid. I wouldn't think working on something so simple would have been so hard when translating from Borland C++ Builder to VS .Net. I guess C++ Builder's RAD spoiled me :/ ) James A Beggs American Quarter Horse Association Manager of Product Development

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #4

        Sounds like you simply need to modify the IDR_MAINFRAME string in the resource file.

        J 1 Reply Last reply
        0
        • D David Crow

          Sounds like you simply need to modify the IDR_MAINFRAME string in the resource file.

          J Offline
          J Offline
          James A Beggs
          wrote on last edited by
          #5

          Well... it has a string in the string table, IDR_ImageFileMasterTYPE (the name if the application is Image FileMaster), and it contains the string that is listed when you do a File->Open, including a path, a filter, etc. But, in modifying the string so that it contained more than one filter made no difference; it listed the new string in the file->open dialog, but didn't actually show the new file extensions. James A Beggs American Quarter Horse Association Manager of Product Development

          D 1 Reply Last reply
          0
          • J James A Beggs

            Well... it has a string in the string table, IDR_ImageFileMasterTYPE (the name if the application is Image FileMaster), and it contains the string that is listed when you do a File->Open, including a path, a filter, etc. But, in modifying the string so that it contained more than one filter made no difference; it listed the new string in the file->open dialog, but didn't actually show the new file extensions. James A Beggs American Quarter Horse Association Manager of Product Development

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #6

            Probably because an MDI app, by default, does not know how to handle more than one file type. Read MSDN article Q141921.

            J 1 Reply Last reply
            0
            • D David Crow

              Probably because an MDI app, by default, does not know how to handle more than one file type. Read MSDN article Q141921.

              J Offline
              J Offline
              James A Beggs
              wrote on last edited by
              #7

              Well, how irritating. I changed the string, as it said, but according to the article, it wasn't enough. Oh well, thanks for the pointer to the article! James A Beggs American Quarter Horse Association Manager of Product Development

              D 1 Reply Last reply
              0
              • J James A Beggs

                Well, how irritating. I changed the string, as it said, but according to the article, it wasn't enough. Oh well, thanks for the pointer to the article! James A Beggs American Quarter Horse Association Manager of Product Development

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #8

                James A Beggs wrote: I changed the string, as it said, but according to the article, it wasn't enough. Right, you must implement at least the first four steps in order to achieve the desired results. Simply changing the string does nothing. I would suggest stepping through the MFC code for opening documents to see what is going on. Knowing how/why MFC does what it does is always helpful.

                J 1 Reply Last reply
                0
                • D David Crow

                  James A Beggs wrote: I changed the string, as it said, but according to the article, it wasn't enough. Right, you must implement at least the first four steps in order to achieve the desired results. Simply changing the string does nothing. I would suggest stepping through the MFC code for opening documents to see what is going on. Knowing how/why MFC does what it does is always helpful.

                  J Offline
                  J Offline
                  James A Beggs
                  wrote on last edited by
                  #9

                  I think I'll also be getting a book on MFC, as I haven't really worked with it either. Thanks again. James A Beggs American Quarter Horse Association Manager of Product Development

                  J 1 Reply Last reply
                  0
                  • J James A Beggs

                    I think I'll also be getting a book on MFC, as I haven't really worked with it either. Thanks again. James A Beggs American Quarter Horse Association Manager of Product Development

                    J Offline
                    J Offline
                    James A Beggs
                    wrote on last edited by
                    #10

                    Actually, could you suggest a good book on MFC? James A Beggs American Quarter Horse Association Manager of Product Development

                    D 1 Reply Last reply
                    0
                    • J James A Beggs

                      Actually, could you suggest a good book on MFC? James A Beggs American Quarter Horse Association Manager of Product Development

                      D Offline
                      D Offline
                      David Crow
                      wrote on last edited by
                      #11

                      "Good" is in the eye of the reader! I have Kruglinski's Inside Visual C++ (which includes nothing for v6), and Mastering MFC Development Using Microsoft Visual C++ 6.0 by Microsoft Press. I believe all books are intended for a particular target audience. I've read very little of either book because most of what they contain I've known about simply by using MFC from its inception (see my earlier note on stepping through code). I'm no MFC expert, and probably learn 1-2 new things about it each week.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups