Results 1 to 8 of 8

Thread: Send file to program via context menu

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2002
    Location
    Kentucky
    Posts
    21

    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?

  2. #2
    Frenzied Member PilgrimPete's Avatar
    Join Date
    Feb 2002
    Posts
    1,313

    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?

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jun 2002
    Location
    Kentucky
    Posts
    21

    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.

  4. #4
    Frenzied Member PilgrimPete's Avatar
    Join Date
    Feb 2002
    Posts
    1,313

    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...

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jun 2002
    Location
    Kentucky
    Posts
    21

    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" ?

  6. #6
    Frenzied Member PilgrimPete's Avatar
    Join Date
    Feb 2002
    Posts
    1,313

    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...

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Jun 2002
    Location
    Kentucky
    Posts
    21

    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.

  8. #8
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    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
  •  



Click Here to Expand Forum to Full Width