Groups | Blog | Home
all groups > dotnet windows forms > march 2008 >

dotnet windows forms : How to launch an app with double-click on filename


Dick Swager
3/11/2008 5:15:17 PM
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
Dick Swager
3/11/2008 10:19:51 PM

[quoted text, click to view]

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
Mattias Sjögren
3/11/2008 11:00:10 PM

[quoted text, click to view]

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 [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
AddThis Social Bookmark Button