LWJGL
May 23, 2012, 03:39:58 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL 2.8.3 released!
 
   Home   Help Search Login Register  



Pages: [1]
  Print  
Author Topic: Open With in windows and linux  (Read 529 times)
tlf30
Regular nerd
**
Posts: 59



« on: January 13, 2012, 16:51:33 »

I'm trying to build a program that will open a custom file format. I was wondering if there was a way to open the file with the program like how you can open a .txt by clicking open on the file in windows and linux.
Logged
CodeBunny
Nerdus Imperius
*****
Posts: 453



WWW
« Reply #1 on: January 13, 2012, 18:30:26 »

I'm not sure how to do it, but I'd recommend switching to a custom file extension. If you give a user the program and they install it, they might get pissed that they see the option for every single text file.
Logged
tlf30
Regular nerd
**
Posts: 59



« Reply #2 on: January 13, 2012, 18:51:48 »

The txt was an example, im using akfw and akfa.
Logged
Fool Running
Nerdus Imperius
*****
Posts: 648


« Reply #3 on: January 19, 2012, 05:40:39 »

On windows, it requires writing values to the registry (HKEY_CLASSES_ROOT has the information). I'm not sure about Linux, but it is probably a file somewhere.
Logged

Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option Grin
tlf30
Regular nerd
**
Posts: 59



« Reply #4 on: January 19, 2012, 09:30:14 »

Thank, but how does the program know what file you are running it from.
Logged
Fool Running
Nerdus Imperius
*****
Posts: 648


« Reply #5 on: January 19, 2012, 10:29:19 »

The file name is passed on the command-line. For instance, in Windows, you specify the command to run when opening a file (located in the registry).
This is an example using my mapping for a Visual Studio .sln file. It will run:
Code:
"C:\Program Files\Common Files\Microsoft Shared\MSEnv\VSLauncher.exe" "%1"
The '%1' gets replaced with the file that the user opened.
Logged

Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option Grin
tlf30
Regular nerd
**
Posts: 59



« Reply #6 on: January 19, 2012, 11:00:12 »

cool thanks!
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines
SMFAds for Free Forums
Valid XHTML 1.0! Valid CSS!