Creating own file extension

Please support our Computer Science advertiser: Learn about neural networks and artificial intelligence.
Reply

Join Date: Jun 2003
Posts: 313
Reputation: red_evolve is on a distinguished road 
Solved Threads: 0
red_evolve's Avatar
red_evolve red_evolve is offline Offline
Posting Whiz

Creating own file extension

 
0
  #1
Nov 3rd, 2004
Greetings.
I've done a search regarding the above subject.
I came across this page: CreateFileAssociation

I'm on my way in developing a desktop application and I need to implement my own file format to store data in the way I want it to be. I'm quite uncertain as to how should I go about first. Anyone here has any idea? How can I benefit from the content of the above link? What do I have to know before implementing this? Thanks a lot.
"Study the past if you would define the future" - Confucius
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 436
Reputation: Chainsaw is an unknown quantity at this point 
Solved Threads: 10
Chainsaw's Avatar
Chainsaw Chainsaw is offline Offline
Unprevaricator

Re: Creating own file extension

 
0
  #2
Nov 4th, 2004
Creating the association means that anytime someone double-clicks on a file with 'your' extension, your program will be launched and your WinMain will get the file name so you can open the file and do whatever you want with it.

So, if that's what you WANT, then this code is for you (and/or having your installer do it for you).

Pick an extension that no one else is using, or you'll have upset customers. In particular, there can be a large number of extensions for images, sounds, videos, and the like. So go to a 'fully loaded' machine with photoshop or its ilk on it, and then look in the registry under the file classes key and you'll see 50-100 extensions already there. Pick something ELSE.

An easy way to avoid these common other files is to pick an extension longer than 3 chars, though there may be compatability issues on non-windows OS', if that matters to you.
Reply With Quote Quick reply to this message  
Join Date: Jun 2003
Posts: 313
Reputation: red_evolve is on a distinguished road 
Solved Threads: 0
red_evolve's Avatar
red_evolve red_evolve is offline Offline
Posting Whiz

Re: Creating own file extension

 
0
  #3
Nov 6th, 2004
Thanks for your feedback.
Err, the thing that is still confusing me is that piece of code provided with the link.
Is it giving me a direction? May I know what does that piece of code do?
A wild guess, it creates a registry key and set the registry key for a new extension? Does any other application with their own extension do this everytime?
"Study the past if you would define the future" - Confucius
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 436
Reputation: Chainsaw is an unknown quantity at this point 
Solved Threads: 10
Chainsaw's Avatar
Chainsaw Chainsaw is offline Offline
Unprevaricator

Re: Creating own file extension

 
0
  #4
Nov 6th, 2004
The MS File Explorer program and others like it, when coming across a file with an extension, look in the registry in a specifc location to see what program is associated with that file's extension.

This code snippet sets the registry up so that those programs can find your program. You only need to do this once at installation time.

As I say, all this does is allow someone to see your file in Explorer, double click on it, and have that run your program.
Reply With Quote Quick reply to this message  
Join Date: Jun 2003
Posts: 313
Reputation: red_evolve is on a distinguished road 
Solved Threads: 0
red_evolve's Avatar
red_evolve red_evolve is offline Offline
Posting Whiz

Re: Creating own file extension

 
0
  #5
Nov 7th, 2004
Okay. So, that means that there is nothing else that I'd have to take care on the file extension creation thing other than just setting up the registry key during installation time?
"Study the past if you would define the future" - Confucius
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 436
Reputation: Chainsaw is an unknown quantity at this point 
Solved Threads: 10
Chainsaw's Avatar
Chainsaw Chainsaw is offline Offline
Unprevaricator

Re: Creating own file extension

 
1
  #6
Nov 7th, 2004
Heck give it a try and see! I haven't done this in a LONG time, so I may not have 100% of the steps down.
Reply With Quote Quick reply to this message  
Join Date: Jun 2003
Posts: 313
Reputation: red_evolve is on a distinguished road 
Solved Threads: 0
red_evolve's Avatar
red_evolve red_evolve is offline Offline
Posting Whiz

Re: Creating own file extension

 
0
  #7
Nov 8th, 2004
Okay. Thanks a lot.
"Study the past if you would define the future" - Confucius
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC