open multiple file extensions in MDI?? 
Author Message
 open multiple file extensions in MDI??

Hello.

I need to be able to open files of several file extensions, which are
all the same "document" type.  Basically, I want MFC's call to
CFileDialog to open it with the szFilter[] field set to multiple
extensions.  The problem is, MFC uses the string resource for opening
such that it just strips 4 characters from it (i.e. ".csv"), so you
can't just change the resource string.  I've tried using multiple
pDocTemplate's, each with it's own string resorce, like:

        CMultiDocTemplate* pDocTemplate;
        pDocTemplate = new CMultiDocTemplate(
                IDR_WINTGATYPE,
                RUNTIME_CLASS(CWinTGADoc),
                RUNTIME_CLASS(CChildFrame), // custom MDI child frame
                RUNTIME_CLASS(CWinTGAView));
        AddDocTemplate(pDocTemplate);

    // added for DOS TGA file types
    pDocTemplate = new CMultiDocTemplate(
                IDR_DOSTGATYPE,
                RUNTIME_CLASS(CWinTGADoc),
                RUNTIME_CLASS(CChildFrame), // custom MDI child frame
                RUNTIME_CLASS(CWinTGAView));
        AddDocTemplate(pDocTemplate);

    // added for CTD file types
    pDocTemplate = new CMultiDocTemplate(
                IDR_CTDTYPE,
                RUNTIME_CLASS(CWinTGADoc),
                RUNTIME_CLASS(CChildFrame), // custom MDI child frame
                RUNTIME_CLASS(CWinTGAView));
        AddDocTemplate(pDocTemplate);

This would work fine.  The user would just choose which type of document
to open.  Actually this is preferable BUT, the only way I can get this
to work is to create 3 identical menus and label them IDR_whatever as
per above.

I _can_ simply call CFileDialog myself, too, but there MUST be a way to
make MFC do this!  If someone could kindly point out what I need to do,
I'd sure appreciate it.

Thanks,

Mark.

--
Mark.    (please remove "SPAMLESS" for email reply)

//---------------------------------------------

// Software Engineer - Cahn Instruments
// 5225 Verona Rd, Madison, WI 53771



Mon, 31 Jul 2000 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Single Document / file extension, multiple views in MDI

2. File Open and multiple extensions?

3. Displaying multiple file extensions on Open Dialog Box

4. File extension filtering for the file dialog presented for file opening

5. changing the default file extension in the file open dialog box

6. Opening multiple docs in MDI??

7. Allowing multiple file extensions when opening/saving MFC MDI documents ?

8. MDI file opens/replaces file in childframe

9. MDI file opens/replaces file in childframe

10. Selecting multiple files in Win File->Open dialog

11. Q: File Open Dialogbox allow multiple file selection

12. MDI Registering file extension-icons

 

 
Powered by phpBB® Forum Software