default file extension

I'm writing a VC++ SDI program. I want to know how to set the default file extension for my application. Like if u use the wordpad.. the default file extension is ".wri"
rw8Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

abhitlyaCommented:
Hi,

Here's what you can do. Go into the Resource Editor and edit the String Table entry for resource IDR_MAINFRAME.

Test\Test Document\nTestDoc\nTestDocs (*.my)\n.my\nTestDoc\nMyTestDoc

This will cause the default file extension to be ".my" in File-Save dialog box.

Regards,
Abhijit
0
rw8Author Commented:
Can u briefly explain what does that line mean?
Anyway,I got an error message when I put "Test\Test Document\nTestDoc\nTestDocs (*.my)\n.my\nTestDoc\nMyTestDoc" as the caption for the IDR_MAINFRAME. THen I removed everything after (*.my) and it seems ok..  is that what I should do? also, when I choose "open" from my applciation, the file type is still  "all file *.*", I wanted it to be also (*.my).. can u tell me how to do that?
0
Vinayak KumbarSr Program ManagerCommented:
Hi,

I think good way will be to over ride those functions and handle them, where in U can give the extenstion in the form of filter.
To do that take a look at the example in OnFileOpen() functions help.

Try it out.
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

olgatCommented:
Hi,
What abhitlya said is correct, but it is only the part of process.
There are some more steps.
It is really long, so I'll just give you a good reference :-)
On MSDN, in MSJ 1996 February issue you can find in an article "Programming Windows 95 with MFC, Part VII: The Document/View Architecture"
written  by Jeff Prosise with full explanation.

In this article pay attention on 2 chapters:
"More on the SDI Document Template"
and
"Registering Document Types"

If you have any additional questions, don't hesitate to ask me.




0
abhitlyaCommented:
Hi,

I am sorry about that typing mistake. There should be a "\n" instead of the "\" in the string. The string is actually divided into 7 parts each of them separated by a "\n", and there's no carriage return in the entire string.

Here's the changed string...

Test\nTest Document\nTestDoc\nTestDocs (*.my)\n.my\nTestDoc\nMyTestDoc

And here's a brief description about what each of the "\n" separated portions means...

1. The window title (not used for MDI applications)
2. The document name
3. Description of the type of document for use when creating a new document
4. Description of the file type for the standard File Open dialog
5. An extension filter
6. Description of file type for use by the File Manager
7. The ProgID that is registered in the Windows Registry

Regards,
Abhijit
0
abhitlyaCommented:
Hi,

I am sorry about that typing mistake. There should be a "\n" instead of the "\" in the string. The string is actually divided into 7 parts each of them separated by a "\n", and there's no carriage return in the entire string.

Here's the changed string...

Test\nTest Document\nTestDoc\nTestDocs (*.my)\n.my\nTestDoc\nMyTestDoc

And here's a brief description about what each of the "\n" separated portions means...

1. The window title (not used for MDI applications)
2. The document name
3. Description of the type of document for use when creating a new document
4. Description of the file type for the standard File Open dialog
5. An extension filter
6. Description of file type for use by the File Manager
7. The ProgID that is registered in the Windows Registry

Regards,
Abhijit
0
rw8Author Commented:
Thanx for your help olgat, but sorry.. I think abhitlya should receive the points.
abhitlya, can you post your answer as asnwer again so that I can accept it?

0
abhitlyaCommented:
Hi,

Here's the changed string...

Test\nTest Document\nTestDoc\nTestDocs (*.my)\n.my\nTestDoc\nMyTestDoc

And here's a brief description about what each of the "\n" separated portions means...

1. The window title (not used for MDI applications)
2. The document name
3. Description of the type of document for use when creating a new document
4. Description of the file type for the standard File Open dialog
5. An extension filter
6. Description of file type for use by the File Manager
7. The ProgID that is registered in the Windows Registry

Regards,
Abhijit
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.