|
-
Mar 9th, 2005, 08:01 AM
#1
Thread Starter
Junior Member
Send file to program via context menu
I have a VB6 program and it accepts files and performs various operations on them (encryption, compression, splitting). I want to be able to right-click on any file on my hard drive and when the context menu pops up one of the choices will be "Open with [MyProgramName]". Selecting that choice, the full path of the file is sent to the program, at which point the user selects what he wants to do with the file (encrypt, decrypt, compress, decompress, split, join). I imagine this involves the Windows Registry in some way. Can anyone help me?
-
Mar 9th, 2005, 08:50 AM
#2
Frenzied Member
Re: Send file to program via context menu
Don't know how to do it with the "Open With" menu option (sorry!), but you could add a shortcut to your app to the user's "Send To" folder.
That would open your application passing the file path as a command line parameter. Does that help?
-
Mar 9th, 2005, 05:21 PM
#3
Thread Starter
Junior Member
Re: Send file to program via context menu
That's an idea. I'll have to find the appropriate API function to find the Send To folder (it's a system folder isn't it?). I'll see what I can do about getting it working. Thanks for the help.
-
Mar 9th, 2005, 06:08 PM
#4
Frenzied Member
Re: Send file to program via context menu
On my Win2K machine, it is
C:\Documents and Settings\*username*\SendTo
Are you looking to automate this (i.e. create an install set), or do it manually? I only ask because I managed to add an exe to the 'Open With' context menu manually this afternoon, but have no idea how to do it programmatically...
-
Mar 11th, 2005, 12:10 AM
#5
Thread Starter
Junior Member
Re: Send file to program via context menu
I haven't had time yet to try anything, but could you describe how you manually implemented the "Open With" ?
-
Mar 11th, 2005, 04:37 AM
#6
Frenzied Member
Re: Send file to program via context menu
I simply chose Open With from the context menu, and browsed for my program. This creates a registry entry for the application under HKEY_CLASSES_ROOT\Applications\MyApp.exe, and creates an entry under the file extension: HKEY_CLASSES_ROOT\.txt\OpenWithList
Now, you can either create your own keys under the file types, or do the whole Browse thing each time.
To be honest the HKEY_CLASSES_ROOT\Applications\MyApp.exe\shell\open\command registry structure looks pretty straightforward, so you could probably do it all programmatically very easily - I just haven't tried it...
-
Mar 12th, 2005, 01:05 PM
#7
Thread Starter
Junior Member
Re: Send file to program via context menu
All I really want to happen is to be able to right-click on a file, choose "Open with [ProgramName]. When this is done, I want it to open my program, adding the selected file to a listbox. I will try experimenting with the ideas shown above.
-
Mar 12th, 2005, 05:54 PM
#8
Re: Send file to program via context menu
Search the forums first please. I asked the same question a little while a go.
Just the a search for "global shell menu extension" and you will find code and all.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|