/// <summary> /// 显示指定文件的文件属性对话框。 /// </summary> /// <param name="fileUrl">指定的文件,如果这个文件不存在,则将会抛出异常。</param> public static void ShowFileAttributesDialog(string fileUrl) { if (!FileExists(fileUrl)) { throw new FileNotFoundException("指定的文件找不到", fileUrl); } else { SShellExecuteInfo info = new SShellExecuteInfo(); info.SizeOfStructure = Marshal.SizeOf(info); info.Verb = "properties"; info.FileUrl = fileUrl; info.ShowFlags = SW_SHOW; info.Flags = SEE_MASK_INVOKEIDLIST; ShellExecuteEx(ref info); } }
private static extern bool ShellExecuteEx(ref SShellExecuteInfo executeInfo);