IShellFolder :: GetUIObjectOf [英] IShellFolder::GetUIObjectOf

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

问题描述

我正在尝试使用由IShellFolder.GetUIObjectOf方法返回的特定文件的COM接口
下面的代码在到达GetUIObjectOf时报告错误尝试读取或写入受保护的内存".请帮忙..


I am trying to use the COM interface of a specific file returned by IShellFolder.GetUIObjectOf Method
The below code reports an error "Attempted to read or write protected memory" when it reaches GetUIObjectOf. Please help..


IntPtr pidlroot;
ShellLib.IShellFolder pShellFolder;
pShellFolder = ShellLib.ShellFunctions.GetDesktopFolder();
ShellLib.ShellApi.SHGetFolderLocation(IntPtr.Zero,
                                      (short)ShellLib.ShellApi.CSIDL.CSIDL_DESKTOP,
                                      IntPtr.Zero,
                                      0,
                                      out pidlroot);

string sPath = "C:\\Documents and settings\\giji\\Desktop\\Class1.cs";
uint var = (uint)sPath.Length;
IntPtr pidlchild;
uint pdw=0;
pShellFolder.ParseDisplayName(IntPtr.Zero, IntPtr.Zero, sPath, ref var, out pidlchild,ref pdw);


Guid riid = new Guid("BB2E617C-0920-11d1-9A0B-00C04FC2D6C1");
IntPtr ppv;
uint len = 1;
uint reser = 0;
IntPtr[] arry = { pidlchild };
pShellFolder.GetUIObjectOf(IntPtr.Zero, len, arry, riid, ref reser, out ppv);





还有其他方法可以获取特定文件的COM接口吗?





Is there any other way to get COM Interface of a specific file

推荐答案

尝试以下链接:

http://stackoverflow.com/questions/1593079/develop-an-application- like-to-windows-explorer [ ^ ]

这是关于该方法的pInvoke页面:

http://www.pinvoke.net/default.aspx/Interfaces/IShellFolder.html [ ^ ]

如果您像我一样搜索方法名称本身,您将获得数百次点击.
Try this link:

http://stackoverflow.com/questions/1593079/develop-an-application-similar-to-windows-explorer[^]

And here''s the pInvoke page about that method:

http://www.pinvoke.net/default.aspx/Interfaces/IShellFolder.html[^]

If you google the method name itself (like I did), you''ll get hundreds of hits.


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

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