File Extensions

  • Thread starter Pauly Man
  • Start date
  • #1
128
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.
 

Answers and Replies

  • #2
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.
 
  • #3
128
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 on File Extensions

  • Last Post
Replies
2
Views
2K
  • Last Post
Replies
4
Views
5K
  • Last Post
Replies
4
Views
5K
  • Last Post
Replies
10
Views
1K
Replies
1
Views
3K
Replies
10
Views
1K
Replies
3
Views
15K
Replies
13
Views
2K
  • Last Post
Replies
4
Views
2K
  • Last Post
Replies
21
Views
2K
Top