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

Posted on 2008-11-05
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:hbash
    LVL 1

    Accepted Solution

    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

    Has anyone gotten this working?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
    Article by: jpaulino
    XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String ( Literal, only instead of starting and ending with w…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now