IShellFolder :: GetAttributesOf [英] IShellFolder::GetAttributesOf

查看:178
本文介绍了IShellFolder :: GetAttributesOf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果获得了该文件夹的IShellFolder接口,我们如何获取该文件夹中某些文件的PIDL?

我使用了IShellFolder :: GetAttributesOf方法,但是它不起作用.以下代码中是否存在任何错误?请提出建议.


ShellLib.IShellFolder pShellFolder;
phellFolder = ShellLib.ShellFunctions.GetDesktopFolder();
IntPtr pidlRoot;
ShellLib.ShellApi.SHGetFolderLocation(IntPtr.Zero,(short)ShellLib.ShellApi.CSIDL.CSIDL_SYSTEM,IntPtr.Zero,0,out pidlRoot);

IntPtr [] arry = {};
uint rgf = 0;
pShellFolder.GetAttributesOf(1,arry,ref rgf);

How can we obtain the PIDLs of some files in a folder, if we got the IShellFolder Interface of that folder?

I used IShellFolder::GetAttributesOf Method, but it doesn''t work. Is there any mistake in the following code? Please suggest.


ShellLib.IShellFolder pShellFolder;
phellFolder = ShellLib.ShellFunctions.GetDesktopFolder();
IntPtr pidlRoot;
ShellLib.ShellApi.SHGetFolderLocation( IntPtr.Zero, (short)ShellLib.ShellApi.CSIDL.CSIDL_SYSTEM, IntPtr.Zero,0,out pidlRoot);

IntPtr[] arry ={ };
uint rgf = 0;
pShellFolder.GetAttributesOf(1, arry, ref rgf);

推荐答案

转到此处了解如何正确使用它:

http://www.pinvoke.net/default.aspx/shell32/SHGetFolderLocation.html [ ^ ]

之后,使用google查找在C#中使用它的示例.我敢肯定,如果您实际使用Visual Studio中提供的调试器,那么您将能够发现它所返回的内容,并且可以对代码进行必要的调整.
Go here to learn how to use it correctly:

http://www.pinvoke.net/default.aspx/shell32/SHGetFolderLocation.html[^]

After that, use google to find examples of using it in C#. I''m sure that if you actually use the debugger provided in Visual Studio, you''ll be able to find out what it''s returning to you, and you can make the necessary adjustments to your code.


这篇关于IShellFolder :: GetAttributesOf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆