如何通过按钮打开文件的属性对话框
private void button_Click(object sender, EventArgs e)
{
string path = @"C:\Users\test\Documents\tes.text";
// how to open this propertie
}
Run Code Online (Sandbox Code Playgroud)
谢谢.
例如,如果想要系统属性
Process.Start("sysdm.cpl");
Run Code Online (Sandbox Code Playgroud)
但是如何获取文件路径的"属性"对话框?
我成功实现了 如何以编程方式调用 Windows 权限对话框?及相关: 如何从 c# 显示文件属性对话框安全选项卡。
public static bool ShowFileProperties(string Filename)
{
SHELLEXECUTEINFO info = new SHELLEXECUTEINFO();
info.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(info);
info.lpVerb = "properties";
info.lpFile = Filename;
info.lpParameters = "Security";
info.nShow = SW_SHOW;
info.fMask = SEE_MASK_INVOKEIDLIST;
return ShellExecuteEx(ref info);
}
Run Code Online (Sandbox Code Playgroud)
但是,我想像使用该对话框中的“编辑..”按钮一样进入“权限”窗口。
有任何想法吗?
我正在尝试编写证书管理器,我想管理证书文件的权限.我不希望重新发明Windows权限对话框的轮子,所以理想情况下会有某种shell命令,我可以传递其权限被管理的项目的路径.然后,我可以调用它并让shell负责更新权限.
我在这里和那里看到过一些shell函数SHObjectProperties,但没有明确说明如何使用它.任何帮助,将不胜感激.