Link to home
Start Free TrialLog in
Avatar of rw8
rw8

asked on

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"
Avatar of abhitlya
abhitlya

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
Avatar of rw8

ASKER

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?
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.
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.




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
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
Avatar of rw8

ASKER

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?

ASKER CERTIFIED SOLUTION
Avatar of abhitlya
abhitlya

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial