How to launch an app with double-click on filename

  • Thread starter Thread starter Dick Swager
  • Start date Start date
D

Dick Swager

I have an Windows Form application that has child Forms in it. I have a
constructor in the main form that takes a filename as an argument an creates
a child form from the data in the file. If I launch the app from the
command prompt with a filename as an argument, it works fine. But if I
launch the application by double-clicking on the filename in Windows
Explorer the child form is not created.

I thought that double-clicking a filename was the same as using the command
prompt with the file name as an argument at the point where the application
is launched, but apparently this is not true. Do I have to handle the two
situations differently in my code? Or do I do something at the OS level
that will make this work as I thought it should?

TIA, Dick
 
I thought that double-clicking a filename was the same as using the command
prompt with the file name as an argument at the point where the application
is launched, but apparently this is not true. Do I have to handle the two
situations differently in my code?

It depends on how you setup the file type association to your
application. You specify in the Registry which application to launch
and what command line arguments it takes when your a file with your
registered extension is launched.


Mattias
 
Mattias Sjögren said:
It depends on how you setup the file type association to your
application. You specify in the Registry which application to launch
and what command line arguments it takes when your a file with your
registered extension is launched.


Mattias

Thanks Mattias,

I thought I had the association set but after looking in the registry I
found where it was pointing to an earlier version of the application. When
I copied the newer version to the directory pointed to by the registry, it
works as expected.

Dick
 
Back
Top