FAQ: how to obtain the file name in Internet cache from a URL

Source: Internet
Author: User
Tags internet cache

Question ===================================================== =

Hello, Zhang Shuo,
I am interested in IE programming. I saw yourArticle.
I used myie for a long time (now called Maxthon). It has a good function, that is, hold down
Press ctrl and drag an image to save the image to a default directory.
). I initially thought it was just to download the image again, but I pulled the network cable and then Ctrl + drag the mouse, or
Saves images.
I plan to write it myself, but iolecommandtarget: exec () and iwebbrowser2: execwb ()
The "Save as" dialog box is displayed.
Can you copy the image from the cache directly?
Thank you very much!

2004-11-05

A: ===================================================== =

In the wininet library, Microsoft provides a series of API functions to operate on Internet cache, so your requirements are easily met. The following example shows how to obtain the file name in the Temporary Internet Directory based on the URL. It is relatively simple to get the URL of the image dragged by the mouse.

DWORD dwentrysize = 0;
Lpinternet_cache_entry_info lpcacheentry;

Char strtemp [80];
DWORD dwtemp;

// assume that lpszurl is the image URL.
If (! Geturlcacheentryinfo (lpszurl, null, & dwentrysize)
{< br> If (getlasterror ()! = Error_insufficient_buffer)
{< br> return false;
}< br> else
lpcacheentry = (lpinternet_cache_entry_info) New char [dwentrysize];
}< br> else
return false;

If (! Geturlcacheentryinfo (lpszurl, lpcacheentry, & dwentrysize ))
{
Return false;
}
Else
{
// Lpcacheentry-> lpszlocalfilename is the name of the lpszurl file in the cache.
Return true;
}


Reference address:FAQ: how to obtain the file name in Internet cache from a URL

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.