Open a File With My Program

I would like to know if it is possible to right-click a file and open it with a program that I wrote. The program just needs to receive the name and location of a text document. I was wondering if there is any way to have my program (console window) receive that info from the click.

Thanks
Are you wanting your program to be able to open any file type?

Or to be associated with a given file type?

Andy
Last edited on
No, I know how to add it to the registry. I want to know how to get the program to receive the name of the file that I clicked on. Is there any way to do that?
I'm pretty sure the path and name of the file are passed as arguments on the command line.
Thanks, that should work.
Actually, that only works through the Command Line. I want the file name passed through from a right-click menu. Any other suggestions?
When the registry value is set up correctly, the file name is passed. The problem with the link that Computergeek01 provided is that it is about setting up the context menu for directories, rather than files.

You could set up a file association, either against specific extensions (if you want to open one or a few different file types using your app) or * (for all types.)

Andy

File Types and File Associations
http://msdn.microsoft.com/en-us/library/windows/desktop/cc144104%28v=vs.85%29.aspx
Thanks, I will look into that.
Topic archived. No new replies allowed.