File Extensions

  • Thread starter Pauly Man
  • Start date
126
0
Hi guys. I have a question about file extensions.

For example, if you create a .txt file, windows seems to know automatically that it is a file that can be opened by notepad or wordpad. It gives it a specific icon, and opens it inside notepad or wordpad.

If I wanted to create a program that saved data in a file extension like .psh (my initials) I know I can do it. But exactly what do I need to code to make windows regonise the extension and give the file a particlular icon, and open up it up in my program etc?

I guess one obvious thing is that my program must be able to recognise the file type and "decode" it.
 

damgo

You need to add the filetype into the registry, which keeps track of that stuff. If you go into Tools->Folder Options->File Types you can browse the associations and enter it manually. If you want your program to do it, use the Registry API functions and put the info in HKEY_CLASSES_ROOT -- you can browse with regedit to see how it's structured, or there are plenty of online tutorials and code snippets.
 
126
0
Thanx for the info Damgo.

Once this session is over at uni I'll have to take a look around the net for some tutorials on the subject.
 

Related Threads for: File Extensions

  • Posted
Replies
2
Views
2K
  • Posted
Replies
4
Views
5K
  • Posted
Replies
4
Views
5K
  • Posted
Replies
10
Views
1K
Replies
1
Views
3K
Replies
10
Views
1K
Replies
3
Views
15K
Replies
13
Views
2K

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving
Top