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