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

Posted on 2008-11-05
Medium Priority
Last Modified: 2012-05-05
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.
Question by:Howard Bash

Accepted Solution

Howard Bash earned 0 total points
ID: 22890216
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


Expert Comment

ID: 23032920
Has anyone gotten this working?

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Screencast - Getting to Know the Pipeline
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question