URLDownloadToCacheFile

Hi,

When I use URLDownloadToCacheFile in my VB Code, I receive the following error:

DLL-Entry Point URLDownloadToCacheFile in URLMON.dll not found

My system is Windows 2000 Professional. urlmon.dll is very likely the most recent version, since it just got updated during a Windows Update (got the same error before the update).
Version Number: 6.0.2800.1400

To make things more confusing: URLDownloadToFile works without a problem, EVEN when I UNREGISTER c:\winnt\system32\urlmon.dll ! How is that possible?

Thanks for your help.
_Mark_Asked:
Who is Participating?
 
amp072397Connect With a Mentor Commented:
Since the only other expert participating obviously agrees to PAQ:
PAQ, refund 250 points
amp, ee admin
0
 
cookreCommented:
It works, and gives you that message?

Could you post the code...
0
 
_Mark_Author Commented:
Well, URLDownloadToFile works, but URLDownloadToCacheFile doesn´t.

Code:

Private Declare Sub URLDownloadToCacheFile Lib "URLMON.dll" ( _
    ByVal lpunknown As Long, _
    ByVal lpcstr As String, _
    ByVal lptstr As String, _
    ByVal dword As Long, _
    ByVal dword As Long, _
    ByRef TLPBINDSTATUSCALLBACK As Long)
   
Private Sub Test()
   Dim url As String
   Dim localFileName As String
   
   On Error GoTo trackError
   
   url = "http://www.google.com/images/logo.gif"
     
   localFileName = Space(255)
   
   URLDownloadToCacheFile 0, url, localFileName, Len(localFileName), 0, 0
     
trackError:

Debug.Print Err.Description

End Sub
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
_Mark_Author Commented:
Found the solution to my problem. Have to use an alias in the API declaration. This works:

Private Declare Function URLDownloadToCacheFile Lib "urlmon" Alias "URLDownloadToCacheFileA" ( _
   ByVal lpUnkcaller As Long, _
   ByVal szURL As String, _
   ByVal szFileName As String, _
   ByVal dwBufLength As Long, _
   ByVal dwReserved As Long, _
   ByVal IBindStatusCallback As Long) As Long
0
 
cookreCommented:
Yup, that's pretty common.

Go to Community Supprt, tell them you solved it yourself, and would they please delete the question and refund the points.

0
 
_Mark_Author Commented:
Okay, thanks for your help though!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.