views:

52

answers:

2

I have a program with an associated file type. However, when I double-click a file to launch the program, I can't figure out where that path was passed to the program.

Initially I thought the file path would be in Environment.CommandLine, but the command line only contained the program path.

I specified the file association using the Publish Options in visual studio like so: extension: .ext, Description: Some File, ProgId: ProjectName, Icon: SomeIcon.ico.

A: 

You are right, it should indeed be passed as a command line argument and be available through Environment.CommandLine.

My guess is that something is wrong with the file association itself. Here is a dated but still useful TechNet article on how these things work. In particular, the "%1" in the screenshot below is essential.

Screenshot of action editing dialog

I'm not sure about the DDE thing, so if you're not using it, turn it off.

Thomas
A: 

As a guess, your file type association may not be configured properly. If you look in the registry at your "Open" command for your file type, the command is probably configured as "c:\your-company\your-app.exe", instead of as "c:\your-company\your-app.exe" "%1", which is what it would need to be if you wanted the file path to show up on the command line.

jwismar
Shouldn't visual studio be setting up that property correctly?
Strilanc