hmmm...I took another work around in linux...
for KDE I used "kfmclient"
for GNOME i used "gnome-open"
just pass the --help as an arguement to see how to use the system
Now as for working for associating a file is concerned...you need to do this:
Quote:
1. download the latest freedesktop-mime-database.
2. create your own file following the standard and add it to database
3. run update-mime-database command
4. run update-desktop-database command
so you see there is technically no code snippet
just a series of commands...
now re-read the info-spec i pointed out previously....you'll understand more completely...what i just said will act as a glue to merge all the not-so-clear spec
Now for Windows: You'll have to play with MFCs/Win32 API for this...look through the docs...am not very well versed this
But here is the shortcut....create a custom extension, open it through explorer...and choose app to open that file!!!!....you could also physically do it by setting the "file type" from the tool>options etc....you know the story)
MAC: hmmmm well MAC was a closed source system...they have now started to release out the API, so try getting your hands on it. I haven't used MAC much, but from what i know, it's a harrowing task
to find the API...but i think some googling around would help...
NOTE: The concept of MIME types is present in all systems (i.e. all systems are merging towards this)...try exploiting this...
in one of the threads by munna, he asked how to open a a .swf by using the default app...here's the link....someone put a code snippet that was damn good...it could be of use to you...
here's the link:
http://www.qtcentre.org/forum/showthread.php?t=2029
see how the registry is accesed using Qt and you could use it to your benefit!!
Bookmarks