3

i got file right click in file explorer but i can't get path file or folder when i right click in desktop

public void GetListOfSelectedFilesAndFolderOfWindowsExplorer()
    {
        string filename;
        ArrayList selected = new ArrayList();
        var shell = new Shell32.Shell();
        //For each explorer
        foreach (SHDocVw.InternetExplorer window in new SHDocVw.ShellWindowsClass())
        {
            filename = Path.GetFileNameWithoutExtension(window.FullName).ToLower();
            if (filename.ToLowerInvariant() == "explorer")
            {
                Shell32.FolderItems items = ((Shell32.IShellFolderViewDual2)window.Document).SelectedItems();
                foreach (Shell32.FolderItem item in items)
                {
                    MessageBox.Show(item.Path.ToString());
                    selected.Add(item.Path);
                }
            }
        }
    }

1 Answers1

0

i solved by add %1 in shell and code in main method

public static void main(string [] args)
  {
    if(args.Length == 1)
    {
       if(args[0] == "/i")
       {
         Console.WriteLine("Parameter i");
       }
    }
  }