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

Re: How to launch an app with double-click on filename by Mattias

Mattias
Tue Mar 11 17:00:10 CDT 2008


>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 [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Re: How to launch an app with double-click on filename by Dick

Dick
Tue Mar 11 21:19:51 CDT 2008


"Mattias Sjögren" <mattias.dont.want.spam@mvps.org> wrote in message
news:e8giEM8gIHA.1132@TK2MSFTNGP06.phx.gbl...
>
>>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 [C# MVP] mattias @ mvps.org
> http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
> Please reply only to the newsgroup.

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