Understanding File Extensions & How To Create Your Own

  • Thread starter Thread starter Pauly Man
  • Start date Start date
  • Tags Tags
    File
AI Thread Summary
To create a custom file extension, such as .psh, that Windows recognizes, you need to implement several key steps. First, your program must be capable of recognizing and decoding the file type. Additionally, you must modify the Windows registry to associate the new file extension with your program. This involves using the Registry API functions to add the necessary information under HKEY_CLASSES_ROOT. Users can manually set file associations through Windows' Folder Options, but automating this through code is more efficient. Exploring online tutorials and code snippets can provide further guidance on the process.
Pauly Man
Messages
129
Reaction score
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.
 
Computer science news on Phys.org
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.
 
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.
 
In my discussions elsewhere, I've noticed a lot of disagreement regarding AI. A question that comes up is, "Is AI hype?" Unfortunately, when this question is asked, the one asking, as far as I can tell, may mean one of three things which can lead to lots of confusion. I'll list them out now for clarity. 1. Can AI do everything a human can do and how close are we to that? 2. Are corporations and governments using the promise of AI to gain more power for themselves? 3. Are AI and transhumans...
Thread 'ChatGPT Examples, Good and Bad'
I've been experimenting with ChatGPT. Some results are good, some very very bad. I think examples can help expose the properties of this AI. Maybe you can post some of your favorite examples and tell us what they reveal about the properties of this AI. (I had problems with copy/paste of text and formatting, so I'm posting my examples as screen shots. That is a promising start. :smile: But then I provided values V=1, R1=1, R2=2, R3=3 and asked for the value of I. At first, it said...

Similar threads

Back
Top