URLDownloadToFile From COM Component (HOW??!)
I am trying to use URL download to file within an ActiveX dll. but I cant get it to work.
The code is a follows:
Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
"URLDownloadToFileA" (ByVal pCaller As Long, _
ByVal szURL As String, _
ByVal szFileName As String, _
ByVal dwReserved As Long, _
ByVal lpfnCB As Long) As Long
Function DownloadFile(strURL As String, strLocalFilename As String) As Boolean
Dim lngRetVal As Long
DownloadFile = False
lngRetVal = URLDownloadToFile(0, strURL, strLocalFilename, 0, 0)
If lngRetVal = 0 Then DownloadFile = True
End Function
I have a feeling that the first parameter can't be null or 0 when using within a dll but I cant find out what to use instead!!