c# 使用 SHDocVw.InternetExplorer。如何找到最后点击的链接的 URL?或者最近的get请求URL?

发布于 2024-08-10 18:44:50 字数 439 浏览 5 评论 0原文

我正在从 SHDocVw.ShellWindowsClass() 访问 SHDocVw.InternetExplorer。我可以看到浏览器实例当前所在的页面(LocationURL 属性),但我真正需要的是为浏览器完成的最后一个 get 请求。我的具体需求是,我的应用程序刚刚启动来处理通过当前网页上的链接下载到用户系统的文件。我需要知道该文件的 URL。 LocationURL 为我提供了链接所在页面的 URL,但我需要文件/链接的 URL。

编辑:我一直尝试与之交互的 Web 应用程序是 SharePoint。我无法找到一种方法来从 Internet Explorer 中提取上次单击的链接(下载的文件)的 URL,因此现在我希望找到一种方法来从 SharePoint 本身或名称上获取该信息SharePoint 使用 ActiveX 控件来管理 MS Office 文档的下载。有 SharePoint/Name ActiveX 专家吗?

I am accessing the SHDocVw.InternetExplorer from the SHDocVw.ShellWindowsClass(). I can see the page that the browser instance is currently on (the LocationURL property), but what I really need is the last get request that was done for the browser. My specific need is that my application was just launched to handle a file that was downloaded to the user's system via a link on the current web page. I need to know the URL of that file. LocationURL gives me the URL of the page that the link is on, but I need the URL of the file/link.

EDIT: The web application I've been trying to interface with is SharePoint. I wasn't able to find a way to extract the URL of the last clicked link (file downloaded) from Internet Explorer, so now I'm hoping to find a way to get that information from either SharePoint itself, or piggyback on the Name ActiveX control that SharePoint uses to manage the download of MS Office documents. Any SharePoint/Name ActiveX experts out there?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

晚雾 2024-08-17 18:44:50

由于您无法使用 IUrlHistoryStg::EnumUrls 从 Internet Explorer 历史记录中获取 URL http://msdn.microsoft.com/en-us/library/aa767720%28VS.85%29.aspx

尝试制作确保文件关联已在框中设置,并且您的应用程序可以从命令行获取文件路径来启动。

我将这些密钥添加到 Win7 机器上的注册表

[HKEY_CLASSES_ROOT\.sdr]
@="sdrfile"

[HKEY_CLASSES_ROOT\sdrfile\shell\open\command]
@="\"D:\\Shenanigans\\MyGreatApp.exe\" \"%1\""

中,IE/Sharepoint 发现了这一点。如果您浏览 HKCR,您会发现设置文件关联会变得更加复杂,但看看这是否有效。

Since you can't get the url from Internet Explorer's history using IUrlHistoryStg::EnumUrls http://msdn.microsoft.com/en-us/library/aa767720%28VS.85%29.aspx

try making sure the file association is setup one the box and that your app can take a file path from the command line to start up.

I added these keys to my registry

[HKEY_CLASSES_ROOT\.sdr]
@="sdrfile"

[HKEY_CLASSES_ROOT\sdrfile\shell\open\command]
@="\"D:\\Shenanigans\\MyGreatApp.exe\" \"%1\""

on a Win7 box and IE/Sharepoint figured it out. If you poke around HKCR you'll see that it can get more complicated to setup file associations, but see if this works.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文