我对P/Invoke不太好。任何人都可以告诉我如何在.NET中声明和使用下面的shell32.dll函数?P/Invoke for shell32.dll的SHMultiFileProperties
从http://msdn.microsoft.com/en-us/library/bb762230%28VS.85%29.aspx:
HRESULT SHMultiFileProperties(
IDataObject *pdtobj,
DWORD dwFlags
);
它是用于显示多个文件系统对象Windows外壳程序属性对话框。
我已经想通了如何使用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,
}
谁能帮助?
这让我在正确的道路上,是一个问题的答案,那么答案+,+ 1 但是,它更复杂。我正在寻找多文件属性(如项目的总大小),而不是文件夹外观设置。幸运的是,我在Code Project上找到了包含必要代码的JFileManager: http://www.codeproject.com/KB/files/JFileManager.aspx 在JDropFiles类中查找CopyFilesToClipboardForDragDrop(paths,pt)。这有助于在IDataObject中创建Shell ID列表数据。 因此,它适用于Vista,但它仍然在Windows 2003上失败。仍在寻找完美的解决方案。 – 2009-08-18 18:44:38