Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

URLDownloadToCacheFile

Posted on 2004-03-21
6
Medium Priority
?
963 Views
Last Modified: 2010-08-05
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.
0
Comment
Question by:_Mark_
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 22

Expert Comment

by:cookre
ID: 10643483
It works, and gives you that message?

Could you post the code...
0
 

Author Comment

by:_Mark_
ID: 10643523
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
 

Author Comment

by:_Mark_
ID: 10643599
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Expert Comment

by:cookre
ID: 10644244
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
 

Author Comment

by:_Mark_
ID: 10644369
Okay, thanks for your help though!
0
 

Accepted Solution

by:
amp072397 earned 0 total points
ID: 10644576
Since the only other expert participating obviously agrees to PAQ:
PAQ, refund 250 points
amp, ee admin
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

660 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question