shell32.dll 的 SHMultiFileProperties 的 P/Invoke
我不太擅长 P/Invoke。 谁能告诉我如何在.NET中声明和使用以下shell32.dll函数?
来自 http://msdn.microsoft.com/en -us/library/bb762230%28VS.85%29.aspx:
HRESULT SHMultiFileProperties(
IDataObject *pdtobj,
DWORD dwFlags
);
用于显示多个文件系统对象的Windows Shell属性对话框。
我已经弄清楚如何对一个文件或文件夹使用 SHObjectProperties:
[DllImport("shell32.dll", SetLastError = true)]
static extern bool SHObjectProperties(uint hwnd, uint shopObjectType, [MarshalAs(UnmanagedType.LPWStr)] string pszObjectName, [MarshalAs(UnmanagedType.LPWStr)] string pszPropertyPage);
public static void ShowDialog(Form parent, FileSystemInfo selected)
{
SHObjectProperties((uint)parent.Handle, (uint)ObjectType.File, selected.FullName, null));
}
enum ObjectType
{
Printer = 0x01,
File = 0x02,
VoumeGuid = 0x04,
}
任何人都可以帮忙吗?
I'm not very good with P/Invoke. Can anyone tell me how to declare and use the following shell32.dll function in .NET?
From http://msdn.microsoft.com/en-us/library/bb762230%28VS.85%29.aspx:
HRESULT SHMultiFileProperties(
IDataObject *pdtobj,
DWORD dwFlags
);
It is for displaying the Windows Shell Properties dialog for multiple file system objects.
I already figured out how to use SHObjectProperties for one file or folder:
[DllImport("shell32.dll", SetLastError = true)]
static extern bool SHObjectProperties(uint hwnd, uint shopObjectType, [MarshalAs(UnmanagedType.LPWStr)] string pszObjectName, [MarshalAs(UnmanagedType.LPWStr)] string pszPropertyPage);
public static void ShowDialog(Form parent, FileSystemInfo selected)
{
SHObjectProperties((uint)parent.Handle, (uint)ObjectType.File, selected.FullName, null));
}
enum ObjectType
{
Printer = 0x01,
File = 0x02,
VoumeGuid = 0x04,
}
Can anyone help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有一个 IDataObject 接口和一个 .NET Framework 中的 DataObject 类。
编辑:我刚刚编译并测试了它,它可以工作(弹出一些带有文件夹外观设置的对话框)。
There's an IDataObject interface and a DataObject class in the .NET Framework.
EDIT: I've just compiled and tested this and it works (pops up some dialog with folder appearance settings).
我可能错误地阅读了您的问题,但我认为您正在寻找文件的扩展文件属性。 即打开 Windows 资源管理器并查看属性、所有者、版权、大小、创建日期等列?
Shell32 中有一个名为 GetDetailsOf 的 API 可以提供此信息。 关于 codeproject 的起始文章
干杯,
约翰
I maybe reading you question incorrectly, but I think you are looking for the extended file properties for files. i.e. opening windows explorer and viewing columns like attributes, owner, copyright, size, date created etc?
There is an API in Shell32 called GetDetailsOf that will provide this information. A starting article on codeproject
Cheers,
John