FAQ: How to get the file name from the URL in Internet Cache

xiaoxiao2021-03-06  97

Q======================================== 张硕, hello, I am currently IE programming is interested in seeing your article online, I feel very good. I used a long time (now called Maxthon), there is a function in it, just to hold down the Ctrl to drag a picture, you can save this picture to a default directory (set in settings) . I just started thinking that it just downloaded the picture once, but I ctrl to the mud, or save the picture. I am going to write a write yourself, but iOleCommandTarget :: exec () and iWebBrowser2 :: execwb () will pop up Save As dialog box. Excuse me, is there any high-stroke to copy the picture directly from cache? thank you very much! 2004-11-05 answer ======================================== in the Wininet library Microsoft provides a range of API functions to operate Internet Cache, so your requirements are easily met. The following example gives the method of obtaining its in the Internet name in the Internet, based on the URL. The URL of the image dragged by the mouse is relatively simple, and details will not be described here.

DWORD DWENTRYSIZE = 0; LPINTERNET_CACHE_ENTRY_INFO LPCACHEENTRY

CHAR STRTEMP [80]; DWORD DWTEMP;

// assumed lpszUrl a picture urlif (GetUrlCacheEntryInfo (lpszUrl, NULL, & dwEntrySize)!) {If (GetLastError () = ERROR_INSUFFICIENT_BUFFER!) {Return FALSE;} else lpCacheEntry = (LPINTERNET_CACHE_ENTRY_INFO) new char [dwEntrySize];} else return FALSE ; if (! geturlcacheentryinfo (lpszurl, lpcacheentry, & dwwentsize) {Return false;} else {// lpcacheentry-> lpszlocalFileName is the file name Return True;}

Quote Address: FAQ: How to get the file name from the URL in Internet Cache

转载请注明原文地址:https://www.9cbs.com/read-96091.html

New Post(0)