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 / Opening Files Through Your .exe

Author
Message
Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 10th Mar 2009 23:58
I was just wondering if you were able to open files through a program you make. What I mean is, you know when you double click an icon or you you right-click and go to "Open With..."? I thought it would be useful to be able to directly open a file, instead of having to put in the filename, etc.

This could be useful for something like a map editor, model editor (like Lightning Limbs), etc.

~QJ
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 11th Mar 2009 02:05
um i'm confused you mean extract things from an exe from within a exe? or extract things from a exe from a seperate program? i have tried the first one couldn't get it to work. the second one is probebly possible but not with db. a exe is made to not be able to get into(doesn't mean its impossible ) that is to protect peoples media.
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 11th Mar 2009 04:33
I think QJ means if you make a program that has it's own custom file type, that you can associate the file with the exe that makes it. Like if you made a matrix editor in DBC that saved the files with the extension .mtx - and clicking on any file with .mtx would launch that executable and maybe even load the .mtx parameters into the executable.

If I understand your question QJ, then the answer is yes. When programming the main tool (the exe), there is a function that can receive external string arguments. This function is CL$().

Whatever the name of the program or argument(s) you want can be passed to this variable. If my matrix editor is named mated.exe, then to attach arguments uppon launch, the command line could look like:
mated.exe -argument1 -argument2 filename etc.
Inside my program, that series of strings is passed to CL$() as a single string. I decide what to do with them. I'd have to parse out the string and tell my program what to do with the pieces. Here's a simple example of loading an x file:



saved as myprog.exe

All I want is a filename so the command line to lauch this would be
myprog.exe "monkey.x" or whatever the filename is.

To get it to auto launch in Windows, then you'd have to associate the file type with myprog.exe . You could do it automatically through the registry when someone installs your program or you could do it using Open with... and making it permanent or when in the windows file manager/explorer you use View > Folder Options > File types . Once the association is done, then everytime you double click on a particular file with that extension, it will launch your DB app.

Enjoy your day.
Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 11th Mar 2009 21:47
YES! Ka-ching! This will be awesome once I start to make useful stuff!

~QJ

Login to post a reply

Server time is: 2025-05-16 14:52:24
Your offset time is: 2025-05-16 14:52:24