本文介绍了在CHtmlView中获取所选文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 大家好! 我是一个使用CHtmlView作为查看我的应用程序中的文件夹和文件的基础。 但是,我需要能够在我的应用程序中知道当用户采取某种操作时按下f.ex.按钮时在视图中选择了哪些文件和文件夹。我广泛搜索了这个,但我无法让它工作。我假设我必须使用IDispatch接口,但每当我调用QueryInformation时,我总是得到接口不支持错误,除非我使用IID_IDispatch而不是IID_IHTMLDocument2,但这似乎也不起作用。 例如: IDispatch * pDisp = this-> GetHtmlDocument(); HRESULT hr = pIHtmlDisp-> QueryInterface(IID_IHTMLDocument2,(void **)&pIHTMLDocument2); hr返回E_NOINTERFACE 因为我们在文件夹视图中对我有意义我有使用IID_IHTMLDocument2的其他变体,但我一直无法提出解决方案。 希望有人可以提供帮助。 亲切的问候 Dark 解决方案 解决方案在于它不是您导航到文件夹视图时获得的HTML文档。 来自其他论坛: 当您查看文件夹和文件时,显示的文档不是HTML文档。它是IShellBrowser或IShellView - 尝试查询那些(如果你得到IShellBrowser,你可以使用QueryActiveShellView获取视图)。 当你得到视图时,查询它IFolderView和调用项目(SVGIO_SELECTION) Igor Tandetnik Hi everyone!Im a using CHtmlView as the base for viewing folders and files in my application.However, I need to be able to know in my application what files and folders are selected in the view when the user takes a certain action (pressing a button f.ex.). I have googled this extensively but I am unable to get it to work. I assume that I have to use the IDispatch interface, but whenever I call QueryInformation I always get "Interface not supported error", unless I use IID_IDispatch instead of IID_IHTMLDocument2, but this doesn't seem to work either.example: IDispatch *pDisp = this->GetHtmlDocument(); HRESULT hr = pIHtmlDisp->QueryInterface(IID_IHTMLDocument2, (void**)&pIHTMLDocument2); hr returns E_NOINTERFACESince we are in the folder view it makes sense to me that I have to use some other variation that the IID_IHTMLDocument2, but I have been unable to come up with a solution.Hope someone can help.Kind regardsDark 解决方案 这篇关于在CHtmlView中获取所选文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!