Results 1 to 6 of 6

Thread: Accessing "Open with" context menu

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Location
    Manchester, England, UK
    Posts
    247

    Accessing "Open with" context menu

    I have a file browser in my VB.net application and I'm trying to either
    a) display the native Explorer file context menu so that users can manipulate files as in Explorer
    or
    b) create a vb.net context menu and list out the associated applications from the registry.

    I have got nowhere with option a) and have been playing with option b).

    So far I have got the default association for my "open" option (\shell\open\command), but poking around in the registry I can't see how to recreate the "open with" list.
    Although in some cases I can see an open with stub and some progId stubs I can't seem to work out a definitive open with list that is standard for each file type.

    Any thoughts on either of these?

  2. #2
    Hyperactive Member
    Join Date
    Jan 2002
    Location
    UK, Suffolk
    Posts
    319

    Re: Accessing "Open with" context menu


  3. #3
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,413

    Re: Accessing "Open with" context menu

    here's a simplified vb.net solution:

    Code:
    Process.Start("RUNDLL32.EXE", "shell32.dll,OpenAs_RunDLL " & FileName)
    where FileName is a full file path

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Location
    Manchester, England, UK
    Posts
    247

    Re: Accessing "Open with" context menu

    Thanks but I've see that link and that is the choose program menu option dialog which as an aside could be useful but I'm after the "open with" context menu items to list them on my datagridview context menu.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Location
    Manchester, England, UK
    Posts
    247

    Re: Accessing "Open with" context menu

    After some further digging I've found various class references :

    HKEY_LOCAL_MACHINE\SOFTWARE\Classes
    HKEY_LOCAL_CURRENT_USER\SOFTWARE\Classes

    Also something similar for Explorer....

    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\


    So somewhere between these and Microsoft.Win32.Registry.ClassesRoot seems to lie the list.
    However it isn't as simple as the "openwith" registry key as it seems to use the "progid" in places too.

    If anyone has a simple routine or algorithm to piece together the "open with" list puzzle it would be much appreciated.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Location
    Manchester, England, UK
    Posts
    247

    Re: Accessing "Open with" context menu

    I found a c# example of what I'm trying to do.
    I'm not 100% sure it works yet and I need to translate it to vb.net, but it suggests and looks like it does what I need.

    http://social.msdn.microsoft.com/For...6-28a781b37f72

Tags for this Thread

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