显示文件的属性页并导航到选项卡

2024-03-11

在我的软件中,我需要显示文件的属性对话框并导航到该属性对话框中的特定选项卡?请告诉我如何使用 C# 实现这一点?

或者 是否可以用自定义属性对话框替换默认属性对话框?


private bool properties(string Filename) 
{
    SHELLEXECUTEINFO info = new SHELLEXECUTEINFO();
    info.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(info);
    info.lpVerb = "properties";
    info.lpParameters = "Details";
    info.lpFile = Filename;
    info.nShow = SW_SHOW;
    info.fMask = SEE_MASK_INVOKEIDLIST;
    return ShellExecuteEx(ref info);
}

通过将 info.lpParameters 设置为您希望在选择该选项卡的情况下打开该选项卡的名称。就我而言,“详细信息”...

是的,您需要 codeteq 编写的声明。

这是我使用的声明:

private const int SW_SHOW = 5;
private const uint SEE_MASK_INVOKEIDLIST = 12;

[DllImport("shell32.dll", CharSet = CharSet.Auto)]
static extern bool ShellExecuteEx(ref SHELLEXECUTEINFO lpExecInfo);

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public 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;

}

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

显示文件的属性页并导航到选项卡 的相关文章

随机推荐