• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 474
  • Last Modified:

How do I add a shell extension to file explorer for vb.net application to pass it a file name?

I have an application which consumes text files and displays the files in grid. I would like to allow the user to right click in windows explorer and have a context menu popup allowing me to pass the right clicked file to my app for it to load and display.

Any advise on this would be greatly appreciated.
Howard Bash
Howard Bash
1 Solution
Howard BashSenior Software EngineerAuthor Commented:
I tried the attached code snippet which did add the registry entry,  but the right click did not display this option.

    Private Function CreateShortCut() As Boolean
        Dim RegKey As String = "SCFViewer.SCFViewer\shell\Open With Single Client Viewer\command"
            If Registry.ClassesRoot.OpenSubKey(RegKey).GetValue("") = "" Then
                Registry.ClassesRoot.CreateSubKey(RegKey).SetValue("", (ControlChars.Quote & Application.ExecutablePath & ControlChars.Quote & " %1"))
            End If
        Catch ex As Exception
            Registry.ClassesRoot.CreateSubKey(RegKey).SetValue("", (ControlChars.Quote & Application.ExecutablePath & ControlChars.Quote & " %1"))
            MessageBox.Show("Explorer Context Entry Added for .txt Files", "Registry entry added:", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
        End Try
    End Function

Open in new window

Has anyone gotten this working?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now