Results 1 to 9 of 9

Thread: Add App Menu To Windows Explorer Right-Click Menu

  1. #1

    Thread Starter
    Member raineym's Avatar
    Join Date
    Dec 2006
    Location
    Roanoke Rapids, NC
    Posts
    54

    Add App Menu To Windows Explorer Right-Click Menu

    I want to add a menu item for my new app in the Windows Explorer right-click menu. I used to have the .NET 3.x code to do so, and I anted to update it to .NET Framework 4.8.1, but it has been ages since I used it and now I can't find the project that I did it for. I don't work with the registry much and I know that is what the previous code did.

    Basically, what I want is a menu that looks like this when you right-click any file (not folder) in Windows Explorer:

    Code:
    MyApp >		
    	Command >
    		Command
    	Command >
    		Command
    	Command >
    		Command
    Any help would be greatly appreciated.
    Michael Rainey
    --------------------
    OS: Windows 11 Professional
    VS: 2022
    Level: Intermediate

    Controls: ImageComboBox

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,945

    Re: Add App Menu To Windows Explorer Right-Click Menu

    The easiest way is to create a .reg file, like this...

    example.reg

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\Copy Path]
    "Icon"="Z:\\Documents\\Visual Studio 2008\\Projects\\copy path\\copy path\\bin\\Release\\copy path.exe,0"

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\Copy Path\Command]
    @="Z:\\Documents\\Visual Studio 2008\\Projects\\copy path\\copy path\\bin\\Debug\\copy path.exe %1"
    Doubleclicking example.reg in explorer will add a 'Copy Path' entry to every file's explorer right click menu. The Icon is the app icon in copy path.exe. The Command links to my app, and passes the clicked file path to my app (%1). Be sure to escape \ by doubling it \\

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

    Re: Add App Menu To Windows Explorer Right-Click Menu

    The Copy Path app is simple...

    Code:
    Module modmain
        Public Sub main(ByVal args() As String)
            Dim path As String
    
            If Not args.First.StartsWith("::") Then
                path = IO.Path.GetFullPath(String.Join(" ", args))
            Else
                path = args.First
            End If
    
            Clipboard.SetText(path)
        End Sub
    End Module

  4. #4

    Thread Starter
    Member raineym's Avatar
    Join Date
    Dec 2006
    Location
    Roanoke Rapids, NC
    Posts
    54

    Re: Add App Menu To Windows Explorer Right-Click Menu

    This is what I am trying to accomplish when right-clicking a file in Windows File Explorer (just an example).
    Attached Images Attached Images  
    Last edited by raineym; Nov 12th, 2024 at 10:18 AM.
    Michael Rainey
    --------------------
    OS: Windows 11 Professional
    VS: 2022
    Level: Intermediate

    Controls: ImageComboBox

  5. #5
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,945

    Re: Add App Menu To Windows Explorer Right-Click Menu

    Registry hives follow a similar design as the windows filesystem. If you want to share the exact data with me, i can create a .reg file for you. You can PM me on this occasion, as i understand if you don't want to make this public...

  6. #6
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,945

    Re: Add App Menu To Windows Explorer Right-Click Menu

    All of those Command entries in your example aren't descriptive

  7. #7
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,945

    Re: Add App Menu To Windows Explorer Right-Click Menu

    %1 after your file path means the registry passes the clicked file path to your app. Any file path explicitly entered should use double forward slashes between directories and filenames

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\ProgramName]
    "Icon"=""

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\ProgramName\Command1]
    "Icon"=""

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\ProgramName\Command1\Command1a]
    "Icon"=""

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\ProgramName\Command1\Command1a\Command]
    @="your file path"

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\ProgramName\Command1\Command1b]
    "Icon"=""

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\ProgramName\Command1\Command1b\Command]
    @="your file path"

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\ProgramName\Command2]
    "Icon"=""

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\ProgramName\Command2\Command2a]
    "Icon"=""

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\ProgramName\Command2\Command2a\Command]
    @="your file path"

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\ProgramName\Command2\Command2b]
    "Icon"=""

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\ProgramName\Command2\Command2b\Command]
    @="your file path"

  8. #8
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,945

    Re: Add App Menu To Windows Explorer Right-Click Menu

    It'll be a lot more readable with actual menuitem names

  9. #9
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,945

    Re: Add App Menu To Windows Explorer Right-Click Menu

    I hope the PM helped. Let me know how you solve the multiple filenames issue. By default, windows will open your app once for every selected filename, where you want it to open once with every filename...

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