Click here to Skip to main content
15,887,356 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Saving, Opening and possible conflicts Pin
PJ Arends25-Apr-05 6:58
professionalPJ Arends25-Apr-05 6:58 
QuestionShould I restrict my program's disk activity? Pin
IGx8924-Apr-05 11:01
IGx8924-Apr-05 11:01 
AnswerRe: Should I restrict my program's disk activity? Pin
PJ Arends24-Apr-05 11:12
professionalPJ Arends24-Apr-05 11:12 
GeneralRe: Should I restrict my program's disk activity? Pin
IGx8924-Apr-05 15:57
IGx8924-Apr-05 15:57 
AnswerRe: Should I restrict my program's disk activity? Pin
Michael Dunn24-Apr-05 21:16
sitebuilderMichael Dunn24-Apr-05 21:16 
GeneralProblem with reading an URL Pin
acroitoriu24-Apr-05 9:56
acroitoriu24-Apr-05 9:56 
GeneralRe: Problem with reading an URL Pin
Michael Dunn24-Apr-05 21:19
sitebuilderMichael Dunn24-Apr-05 21:19 
GeneralRe: Problem with reading an URL Pin
acroitoriu25-Apr-05 2:45
acroitoriu25-Apr-05 2:45 
I tried ti use DeleteUrlCacheEntry() and even found a more complete function:
<br />
#include <wininet.h><br />
//......<br />
BOOL DelTempFiles()<br />
{<br />
    BOOL bResult = FALSE;<br />
    BOOL bDone = FALSE;<br />
    LPINTERNET_CACHE_ENTRY_INFO lpCacheEntry = NULL;<br />
<br />
    DWORD  dwTrySize, dwEntrySize = 4096; // start buffer size<br />
    HANDLE hCacheDir = NULL;<br />
    DWORD  dwError = ERROR_INSUFFICIENT_BUFFER;<br />
<br />
    do<br />
    {<br />
        switch (dwError)<br />
        {<br />
            // need a bigger buffer<br />
            case ERROR_INSUFFICIENT_BUFFER:<br />
                delete [] lpCacheEntry;<br />
                lpCacheEntry = (LPINTERNET_CACHE_ENTRY_INFO) new char[dwEntrySize];<br />
                lpCacheEntry->dwStructSize = dwEntrySize;<br />
                dwTrySize = dwEntrySize;<br />
                BOOL bSuccess;<br />
                if (hCacheDir == NULL)<br />
<br />
                    bSuccess = (hCacheDir<br />
                      = FindFirstUrlCacheEntry(NULL, lpCacheEntry,<br />
                      &dwTrySize)) != NULL;<br />
                else<br />
                    bSuccess = FindNextUrlCacheEntry(hCacheDir, lpCacheEntry, &dwTrySize);<br />
<br />
                if (bSuccess)<br />
                    dwError = ERROR_SUCCESS;<br />
                else<br />
                {<br />
                    dwError = GetLastError();<br />
                    dwEntrySize = dwTrySize; // use new size returned<br />
                }<br />
                break;<br />
<br />
             // we are done<br />
            case ERROR_NO_MORE_ITEMS:<br />
                bDone = TRUE;<br />
                bResult = TRUE;<br />
                break;<br />
<br />
             // we have got an entry<br />
            case ERROR_SUCCESS:<br />
<br />
                // don't delete cookie entry<br />
                if (!(lpCacheEntry->CacheEntryType & COOKIE_CACHE_ENTRY))<br />
<br />
                 DeleteUrlCacheEntry(lpCacheEntry->lpszSourceUrlName);<br />
<br />
                // get ready for next entry<br />
                dwTrySize = dwEntrySize;<br />
                if (FindNextUrlCacheEntry(hCacheDir, lpCacheEntry, &dwTrySize))<br />
                    dwError = ERROR_SUCCESS;<br />
<br />
                else<br />
                {<br />
                    dwError = GetLastError();<br />
                    dwEntrySize = dwTrySize; // use new size returned<br />
                }<br />
                break;<br />
<br />
            // unknown error<br />
            default:<br />
                bDone = TRUE;<br />
                break;<br />
        }<br />
<br />
        if (bDone)<br />
        {<br />
            delete [] lpCacheEntry;<br />
            if (hCacheDir)<br />
                FindCloseUrlCache(hCacheDir);<br />
<br />
        }<br />
    } while (!bDone);<br />
    return bResult;<br />
}<br />

I tried to use this function but I get the following errors:
<br />
--------------------Configuration: HS_VC - Win32 Debug--------------------<br />
Compiling...<br />
HS_VCDlg.cpp<br />
Linking...<br />
HS_VCDlg.obj : error LNK2001: unresolved external symbol __imp__FindCloseUrlCache@4<br />
HS_VCDlg.obj : error LNK2001: unresolved external symbol __imp__DeleteUrlCacheEntry@4<br />
HS_VCDlg.obj : error LNK2001: unresolved external symbol __imp__FindNextUrlCacheEntryA@12<br />
HS_VCDlg.obj : error LNK2001: unresolved external symbol __imp__FindFirstUrlCacheEntryA@12<br />
Debug/HS_VC.exe : fatal error LNK1120: 4 unresolved externals<br />
Error executing link.exe.<br />
<br />
HS_VC.exe - 5 error(s), 0 warning(s)<br />
<br />

Can anyone tell me why do I get those errors ? What is wrong... where is my mistake?
Please help me...Confused | :confused:

Croitoriu Andrei
croi2001@yahoo.com
GeneralRe: Problem with reading an URL Pin
Michael Dunn25-Apr-05 6:17
sitebuilderMichael Dunn25-Apr-05 6:17 
GeneralCString question - urgent Pin
hithesh24-Apr-05 9:00
hithesh24-Apr-05 9:00 
GeneralRe: CString question - urgent Pin
PJ Arends24-Apr-05 9:04
professionalPJ Arends24-Apr-05 9:04 
GeneralRe: CString question - urgent Pin
hithesh24-Apr-05 9:39
hithesh24-Apr-05 9:39 
GeneralRe: CString question - urgent Pin
Maximilien24-Apr-05 11:19
Maximilien24-Apr-05 11:19 
GeneralRe: CString question - urgent Pin
hithesh24-Apr-05 15:44
hithesh24-Apr-05 15:44 
GeneralRe: CString question - urgent Pin
ThatsAlok24-Apr-05 18:59
ThatsAlok24-Apr-05 18:59 
GeneralRe: CString question - urgent Pin
toxcct24-Apr-05 20:44
toxcct24-Apr-05 20:44 
GeneralText Object Model Pin
Jim Crafton24-Apr-05 8:57
Jim Crafton24-Apr-05 8:57 
GeneralStructions in Windows Pin
Grahamfff24-Apr-05 8:52
Grahamfff24-Apr-05 8:52 
GeneralRe: Structions in Windows Pin
PJ Arends24-Apr-05 9:18
professionalPJ Arends24-Apr-05 9:18 
GeneralCompression Pin
_Jackie24-Apr-05 8:16
_Jackie24-Apr-05 8:16 
GeneralRe: Compression Pin
John M. Drescher24-Apr-05 9:20
John M. Drescher24-Apr-05 9:20 
GeneralRe: Compression Pin
PJ Arends24-Apr-05 9:21
professionalPJ Arends24-Apr-05 9:21 
Generalvc++ progamming for multimedia Pin
ahmadmz24-Apr-05 7:35
ahmadmz24-Apr-05 7:35 
GeneralPlease Help me, Excel Automation with MFC Pin
lee kyu sub24-Apr-05 6:27
lee kyu sub24-Apr-05 6:27 
Generalhelp me about Explorer-like program Pin
NPDemon24-Apr-05 5:59
NPDemon24-Apr-05 5:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.