就是右击->属性,那个窗口。
有路径,怎么实现呢?搜索下了,好像是可以用SHELL做,用到啥PIDL,
有点复杂,不是很懂,
哪位高手指点一下。

解决方案 »

  1.   

    显示属性页
      IShellFolder接口不仅提供对外壳内部数据结构的存取,也可以调用界面元素进行交互。例如,使用IShellFolder.GetUIObjectOf 方法,可以请求上下文相关菜单。在下面代码中演示了如何操作PIDL来获得IContextMenu 接口,并通过IContextMenu来调用菜单命令,比如显示属性页,调用我的电脑的属性命令显示属性页的示意图如图2.17所示procedure ShowProperties(Handle: HWND; ItemList: PItemIDList); overload;
      var
      Desktop: IShellFolder;
      Folder: IShellFolder;
      ParentList: PItemIDList;
      RelativeList: PItemIDList;
      ContextMenu: IContextMenu;
      CommandInfo: TCMInvokeCommandInfo;
      Begin
      ParentList := ILClone(ItemList);
      if ParentList <> nil then
      try
      ILRemoveLastID(ParentList);
      OleCheck(SHGetDesktopFolder(Desktop));
      OleCheck(Desktop.BindToObject(
      ParentList, nil, IID_IShellFolder,Folder));
      RelativeList := ILFindChild(ParentList, ItemList);
      OleCheck(Folder.GetUIObjectOf(Handle, 1, RelativeList,
      IID_IContextMenu, nil, ContextMenu));
      FillChar(CommandInfo, SizeOf(TCMInvokeCommandInfo), #0);
      with CommandInfo do
      begin
      cbSize := SizeOf(TCMInvokeCommandInfo);
      hwnd := Handle;
      lpVerb := 'Properties';
      nShow := SW_SHOW;
      end;
      OleCheck(ContextMenu.InvokeCommand(CommandInfo));
      Finally
      ILFree(ParentList);
      end;
      end;
      procedure ShowProperties(Handle: HWND; 
      const DisplayName: string); overload;
      var
      ItemList: PItemIDList;
      Begin
      ItemList := ILCreateFromPath(PChar(DisplayName));
      Try
      ShowProperties(Handle, ItemList)
      Finally
      ILFree(ItemList);
      end;
      end;VB代码不懂,
    Desktop
    ILFree,OleCheck,
    真看不懂!
      

  2.   

    这是Delphi代码,不是VB。
    也可以用API ShellExecuteEx,lpVerb给"properties"。
      

  3.   

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Runtime.InteropServices;namespace ThreeTorches
    {
        class ShellExe
        {
            [DllImport("shell32.dll", CharSet = CharSet.Auto)]
            static extern bool ShellExecuteEx(ref SHELLEXECUTEINFO lpExecInfo);        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
            private struct SHELLEXECUTEINFO
            {
                public int cbSize;
                public uint fMask;
                public IntPtr hwnd;
                [MarshalAs(UnmanagedType.LPTStr)]
                public string lpVerb;
                [MarshalAs(UnmanagedType.LPTStr)]
                public string lpFile;
                [MarshalAs(UnmanagedType.LPTStr)]
                public string lpParameters;
                [MarshalAs(UnmanagedType.LPTStr)]
                public string lpDirectory;
                public int nShow;
                public IntPtr hInstApp;
                public IntPtr lpIDList;
                [MarshalAs(UnmanagedType.LPTStr)]
                public string lpClass;
                public IntPtr hkeyClass;
                public uint dwHotKey;
                public IntPtr hIcon;
                public IntPtr hProcess;
            }        private const int SW_SHOW = 5;
            private const uint SEE_MASK_INVOKEIDLIST = 12;
            /// <summary>
            /// 显示指定的文件(夹)属性对话框
            /// </summary>
            /// <param name="filename">要显示属性对话框的文件(夹)完整路径</param>
            public static void ShowFileProperties(string filename)
            {
                SHELLEXECUTEINFO info = new SHELLEXECUTEINFO();
                info.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(info);
                info.lpVerb = "properties";
                info.lpFile = filename;
                info.nShow = SW_SHOW;
                info.fMask = SEE_MASK_INVOKEIDLIST;
                ShellExecuteEx(ref info);
            }    }
    }
      

  4.   


    [DllImport("Shell32.dll")]
            public static extern int ShellExecuteEx(SHELLEXECUTEINFO lpExecInfo);        static void Main(string[] args)
            {
                SHELLEXECUTEINFO ShExecInfo = new SHELLEXECUTEINFO();
                ShExecInfo.cbSize = 90;
                ShExecInfo.fMask = 0xC;
               ShExecInfo.hwnd = 0;
                ShExecInfo.lpVerb = "properties";
                ShExecInfo.lpFile = @"c:\"; //can be a file as well
                ShExecInfo.lpParameters = "";
                ShExecInfo.lpDirectory = null;
                ShExecInfo.nShow =(int)ShowCommands.SW_SHOW;
                ShExecInfo.hInstApp = 0;
                ShellExecuteEx( ShExecInfo);
            }
    程序一闪而过,怎么没弹出来?
      

  5.   

    我试验过 XiaNao16888 的代码了。只有1句错了info.lpVerb = "properties";
      

  6.   

    to:
    XiaNao16888,
    帮我把类都写好了,嘿嘿