none
About the VBShellExtContextMenuHandler RRS feed

  • Question

  • I have built own shell extension using the VBShellExtContextMenuHandler.

    https://www.codeproject.com/kb/dotnet/csshellextcontextmenuhand.aspx

    And got the selected files from right-click menu successfully, but i want to startup my program in this dll and pass the selected file as parameters to my program, i add the code in the "OnVerbDisplayFileName" sub.

            Private Sub OnVerbDisplayFileName(ByVal hWnd As IntPtr)

               Dim p As New Process
               p.StartInfo.FileName = "MyApp.exe"
               p.StartInfo.Arguments = selectedFile
              p.Start()

    End Sub

    But why cannot startup my program?

    Tuesday, July 17, 2018 7:44 AM

Answers

All replies

  • I found the problem is that the dll cannot find the right file path of my program, although i put the dll and my program in the same folder, i used the  System.Windows.Forms.MessageBox.Show(Environment.CurrentDirectory) in dll to return "c:\windows\system32" but no the actual file path, why? how to return the actual path of the shell extension dll?
    Tuesday, July 17, 2018 2:13 PM
  • Did your try

    AppDomain.CurrentDomain.BaseDirectory


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Wednesday, July 18, 2018 3:10 AM
    Moderator
    • Marked as answer by gaxjyxq Wednesday, July 18, 2018 12:24 PM
    Wednesday, July 18, 2018 12:24 PM