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 Discussion / Creating my own file type

Author
Message
programmer 1230
21
Years of Service
User Offline
Joined: 7th May 2004
Location: Grosse Ile, Michigan
Posted: 14th Jul 2004 03:24
How do I create my own file type, so when someone double clicks the file, it loads my application?
BearCDPOLD
21
Years of Service
User Offline
Joined: 16th Oct 2003
Location: AZ,USA
Posted: 14th Jul 2004 10:39 Edited at: 14th Jul 2004 10:42
This requires serious planning and exact code. You need to decide what information you want your file to store, I assume you've figured that out already. Then you need to decide what information your program needs to know for using this file efficiently while running.
Next you have two options:either use an actual ASCII text file, or just use an array. The file format for the level editor of my game is comprised of ten string arrays that store the various aspects of a level for the game. The good thing about this is it makes it difficult for any joe schmoe to open your files in notepad and edit them to his liking. The bad thing about this is anybody with DarkBasic can open up your arrays and change them around that way, and using multiple arrays can give away your file structure if you want to keep that confidential.
The advantage of using a text file is that it can be encrypted by shifting ASCII character values over a few when saving, then moving them back when loading.
Another option is using memblocks, unfortunately my knowledge on them is quite limited, but in the right hands they are powerful.

Once you have your format planned and implemented in code you will have to register it with windows as a recognized file type, usually with an installation program or manually if you don't want to distribute. You also need to make sure that your program can accept files instantly when opened--unfortunately I don't know how to do that.

Crazy Donut Productions, Current Project: KillZone
Web Site Button Does Not Work, Visit Here: http://www.geocities.com/crazydonutproductions/index.html
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 14th Jul 2004 19:17
To "register" it with windows, you need to add a registry entry. What and where, I do not know.

To get the program to read the file, what you do, is the registry entry executes your program with the file that was doubleclicked as the Command Line switch for the exe.

To retreive this, call CL$() and it will give you the full path to the file that was double clicked. Then, you just open this file up via your application, and do whatever to it

Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Emperor Baal
21
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 14th Jul 2004 19:29
Register registry path:

HKEY_CLASSES_ROOT \ .extension \ extra-info

example:



That's for bmp's. The problem is, I don't have a damn clue what all does entries mean Might want to www.google.com or something

Also, adding an entry using DarkBASIC is kinda hard, because it automaticly adds HKEY_LOCAL_MACHINE.

Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 14th Jul 2004 22:54
No need to change the registry manually. The first time you double click the file in Windows, a box appears asking you to select a program from the list to associate that file type with. Browse and find you DB program, and select it to always open this file type with that program. By default, I think, the file's path and name is used as the program's switch.

"eureka" - Archimedes

Login to post a reply

Server time is: 2025-05-24 22:36:55
Your offset time is: 2025-05-24 22:36:55