To open the selected file, you need to implement command-line parameters. Take a look at your Program.cs
file and the Main
function.
You want its signature to look something like this:
static void Main(string[] args)
{
}
The args
array will be the array of command-line params passed to your application. So if you ran MyNewLogParser myLog.txt
, the contents of args[0]
would be myLog.txt
.
For the OpenWith... menu, you'll need to modify the registry. Search for the "OpenWith" key in Regedit and you'll find it. On my machine (Windows 7), it's in
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts
. I'm not sure on the exact details of how it works, but Google should be able to help you out from there.
If you don't want to do it programmatically, I'm pretty sure there's some menu item that allows you to select the application that will open a file. Don't recall what it is on XP, though. Alternatively, you can associate a file extension with your application through a tab in the Folder Options dialog, so that double-clicking it opens your application.