troubleshooting Question

VB.NET adding open with to right clicking some file type

Avatar of Howard Bash
Howard BashFlag for United States of America asked on
SecurityVisual Basic.NETWindows 7
5 Comments2 Solutions333 ViewsLast Modified:
I am looking for a snippet of code that can update the registry and associated an application with a file type having a friendly form of the application appear on the right click popup which will allow me to send the right-clicked upon file to my application.

So far, in Windows 7, logged in as Admin,  I cannot seem to make programmatic change to do this from VB.

Attached is the failing code.

Private Function CreateOpenWith(ByVal sFileExtension As String, ByVal sFriendlyCommand As String) As Boolean

        Registry.ClassesRoot.CreateSubKey(".hello").SetValue("", "Hello", Microsoft.Win32.RegistryValueKind.String)
        Registry.ClassesRoot.CreateSubKey("Hello\shell\open\command").SetValue("", Application.ExecutablePath & " ""%l"" ", Microsoft.Win32.RegistryValueKind.String)

    End Function
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros