Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How do I add more file extension types to the default File…Open Dialog when opening a document?

0
Posted

How do I add more file extension types to the default File…Open Dialog when opening a document?

0

A. MFC pays attention to the document types registered with the CDocTemplate and MultiDocTemplate classes (for SDI and MDI, repsectively). Normally, MFC assumes that for each document type (and therefore, each file extension type) a CDocument class has been defined to handle that type. It’s not actually important to create different document classes (one CDocument can handle several document types). The code you want to look at is in the InitInstance of your application object. Here, you will find code that looks similar to: CMultiDocTemplate* pDocTemplate; pDocTemplate = new CMultiDocTemplate( // or CDocTemplate IDR_SOMETYPE, RUNTIME_CLASS(CSomeDoc), RUNTIME_CLASS(CChildFrame), // custom MDI child frame RUNTIME_CLASS(CSomeView)); AddDocTemplate(pDocTemplate); This call registers a CDocument class and the view and file types associated with it. Your key here is the IDR_SOMETYPE, the second parameter. If you look for this ID in the string table, you will find something like: \nSome\nSom

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123