c# using SHDocVw.InternetExplorer. How can I find the URL of the last link clicked? Or the most recent get request URL?
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 nee开发者_开发知识库d 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?
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.
Sink DWebbrowserEvents2::OnBeforeNavigate2.
精彩评论