Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / How do I associate a file extension with my editor?

Author
Message
MSon
22
Years of Service
User Offline
Joined: 13th Jul 2004
Location: Earth, (I Think).
Posted: 28th Sep 2010 23:05
How do I associate a file extension with a program?

i've completed my load and save funtcions, and added the following line of code so i can get a file name passed through via CL$()



But the only way i've tested this is manually selecting my editor, i think a File Extension can automatically be associated with it via the registry, but i dont want to start messing around with the registry until i know what i need to add and where.

Thanks for any help

Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 29th Sep 2010 01:15 Edited at: 29th Sep 2010 01:17
You go into Windows Explorer either the link usually found in Programs\Accessories or via My Documents on the desktop (there are other ways too). On the top menu click on Tools and select Folder Options. In the menu that pops up hit the File Types tab and click New. Type in the extension and hit Ok. Select the extension on the list and click Change then click "Select the program from a list" and hit Ok. If you don't see your program hit Browse. Once you select and open it as long as there's a check mark by "Always use the selected program to open this kind of file" it'll always use your program when you click twice on a file with that extension (unless you delete the extension from the list).

Now if you want to use that extension on computers that use your program you can copy your own extension from the registry to add it to another persons computer via regedit.

MSon
22
Years of Service
User Offline
Joined: 13th Jul 2004
Location: Earth, (I Think).
Posted: 29th Sep 2010 01:25 Edited at: 29th Sep 2010 01:26
on my machine i've already done as you said to associate it manually, but i have no idea where in the registry its stored, i've tried searching, but cant find it, I found a key in HKEY_CLASSES_ROOT\.dbw, but it dosnt seem to store a relivent value, so i assume its somwhere else in the registry, but dont know where.

Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 29th Sep 2010 02:00
Usually there's a reference to another entry in the registry. Like in the extension .dba and .dbpro it says "dba_auto_file" and "dbpro_auto_file". If you look that up in the same area (HKEY_CLASSES_ROOT) you'll see exactly which program it opens. You won't see it if you didn't add OPEN to the extension. Check out the attached pic.

MSon
22
Years of Service
User Offline
Joined: 13th Jul 2004
Location: Earth, (I Think).
Posted: 29th Sep 2010 02:18 Edited at: 29th Sep 2010 02:23
Thanks Grog, Found it, Should be able to add some code to automatically check and update, thank.

It was located here
"HKEY_CLASSES_ROOT\dbw_auto_file\shell\open\command"

Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 30th Sep 2010 01:57
I actually happen to have a plugin written for that purpose
I think it was originally made for SMD3D_Interactive's QMidi project and I can't directly claim to have used it much myself, but I assume it is in working condition.

Commands:
REGISTER FILETYPE extension$, subKey$, description$, application$ [, icon$] [(optionally returns errorCode)]
FILETYPE REGISTERED(extension$, subKey$)

application$ is the absolute path to the application that the file type should be associated with.
icon is an absolute path to an icon to use for the file type.
errorCode is a non-zero value in case an error occurred while trying to register the file type.

Also, calling REGISTER FILETYPE on an already registered file type will simply update it's data. The plugin doesn't support deletion of file type associations, but it's just a matter of searching for the subKey$ name in the registry and manually deleting it, should you need to.

~~~~~~~~~~~~~~~~
I see you already fixed it, but figured I could post this anyway

MSon
22
Years of Service
User Offline
Joined: 13th Jul 2004
Location: Earth, (I Think).
Posted: 30th Sep 2010 02:26
That DLL will be much better than my method, thanks...

Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 30th Sep 2010 18:00
Glad it could be of use

MSon
22
Years of Service
User Offline
Joined: 13th Jul 2004
Location: Earth, (I Think).
Posted: 8th Oct 2010 02:03
hi, sorry to bring up an old subject, but just tried to use the DLL attached above, but its always returning a value of 1, even if you pass an Invalid extention, i assume im using it wrong...




Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 9th Oct 2010 14:11
Weird, that returns zero for me...
It is necessary to specify the correct subkey name for that function to work properly though.

Login to post a reply

Server time is: 2026-07-22 03:51:22
Your offset time is: 2026-07-22 03:51:22