Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Opening the Shell File/Folder Properties Dialog

Opening the Shell File/Folder Properties Dialog

Scheduled Pinned Locked Moved C#
linuxquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DigitalKing
    wrote on last edited by
    #1

    Hi, Is there any way to programmatically open the Shell file/folder properties dialog for a given file? Is it possible to open this dialog to a given tab? Thanks, DigitalKing

    R 1 Reply Last reply
    0
    • D DigitalKing

      Hi, Is there any way to programmatically open the Shell file/folder properties dialog for a given file? Is it possible to open this dialog to a given tab? Thanks, DigitalKing

      R Offline
      R Offline
      Ravi Bhavnani
      wrote on last edited by
      #2

      DigitalKing wrote:

      Is there any way to programmatically open the Shell file/folder properties dialog for a given file?

      Yes.[^] :) [edit] Sorry - I was hasty in posting this note. See this[^] link instead. You'll need to convert the code to C#. [/edit] /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com

      D 1 Reply Last reply
      0
      • R Ravi Bhavnani

        DigitalKing wrote:

        Is there any way to programmatically open the Shell file/folder properties dialog for a given file?

        Yes.[^] :) [edit] Sorry - I was hasty in posting this note. See this[^] link instead. You'll need to convert the code to C#. [/edit] /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com

        D Offline
        D Offline
        DigitalKing
        wrote on last edited by
        #3

        Great! Thanks. In case anyone else is interested, here's the code I came up with.

        private const uint SW_SHOW = 5;
        private const uint SEE_MASK_INVOKEIDLIST = 0xC;
        private struct SHELLEXECUTEINFO
        {
        public int cbSize;
        public uint fMask;
        public IntPtr hwnd;
        public string lpVerb;
        public string lpFile;
        public string lpParameters;
        public string lpDirectory;
        public uint nShow;
        public uint hInstApp;
        //optional fields
        public string lpIDList;
        public string lpClass;
        public IntPtr hkeyClass;
        public IntPtr dwHotKey;
        public IntPtr hIcon;
        public IntPtr hProcess;
        }

        [DllImport("shell32.dll")]
        private static extern long ShellExecuteEx(ref SHELLEXECUTEINFO s);

        public static void DisplayFileProperties(string path)
        {
        SHELLEXECUTEINFO shInfo = new SHELLEXECUTEINFO();
        shInfo.lpFile = path;
        shInfo.nShow = SW_SHOW;
        shInfo.fMask = SEE_MASK_INVOKEIDLIST;
        shInfo.lpVerb = "properties";
        shInfo.cbSize = Marshal.SizeOf(shInfo);
        ShellExecuteEx(ref shInfo);
        }

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups