Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28615 Discussions

Double-click Application Startup

jcbreeding
Beginner
746 Views
I have a QuickWin application that I would like to be able to start up by double-clicking on an input data file
having an extension (like .asc) which has been associated with my application. How would I implement this
so that the application can get the file name and working directory?

Also, how would I be able to debug the code in the Debugger once I have made this change? Double-clicking
just starts the application without the debugger environment.


Jim Breeding
0 Kudos
5 Replies
jcbreeding
Beginner
746 Views
I tried using GETARG and it sort of works but there is a problem caused by some subdirectories having spaces in their names (such as "Program Files"). GETARG seems to parse the "command" using spaces as the delimiter between commands so it breaks the input file path name into several strings. Is there a simple way to get the file name into one string without writing a routine to append the strings together and guess where the spaces go?

I still don't know how to debug a program activated with this feature.

Jim Breeding
0 Kudos
Steven_L_Intel1
Employee
746 Views
GETARG is just doing what Windows would do for the command line token separators.

I don't know of a way to debug a program started this way, but you can, in Developer Studio, select Project..Options..Debug and specify command line parameters. If a parameter has embedded spaces, surround it in quotes.

Steve
0 Kudos
isn-removed200637
746 Views
Well, NARGS() and GETARG work fine for me even when
file paths have spaces in them (I am using WINDOWS 2000). You can use Explorer..
tools..folder options..filetypes tab to associate your application with files of a particular extension and get
it to fire up with a double-click on file name as if you
started the application from a command line with the filename as argument. You can even get drag-and-drop capability using NARGS and GETARG, if you create a desk-top shortcut icon and drop a filename onto it.
Just make sure that you assign a large enough character buffer [ e.g. CHARACTER($MAXPATH) ] in your routine that calls GETARG to take the filename and full path.
0 Kudos
jcbreeding
Beginner
746 Views
I'm using Windows NT. I can write a kluge to append the text segments together to get a proper pathname. Just seems a shame to have to do that.

Jim Breeding
0 Kudos
Jugoslav_Dujic
Valued Contributor II
746 Views
I guess it's a bug in NT's extension registration utility. In Explorer, Tools/Options/File Types, the command for starting the application should be
"C:SomewhereMyApp.exe" "%1"

not, as I suspect,
"C:SomewhereMyApp.exe" %1

Jugoslav
0 Kudos
Reply