The following code compiles under PBWin9 with no errors, but at runtime I get this message:
Here's the info on the URLMON.DLL that resides in c:\Windows\system32 (I searched but found no other copies)
urlmon.dll 1,159,680 .a.. 2008-06-23 11:57:40
I'm on Win XP Pro SP3, up to date.
I'm not sure what to make of this, since the Download in Block 2 shows that URLMON.DLL is doing something OK... (Comment out Block 1, the CheckURL function, and the Declares for IsValidURL; the Block 2 code runs fine...)
Help?
Thanks,
-John
MyApp.exe - Entry Point Not Found
X The procedure entry point IsValidUrl could not be located in the dynamic link library URLMON.DLL
X The procedure entry point IsValidUrl could not be located in the dynamic link library URLMON.DLL
urlmon.dll 1,159,680 .a.. 2008-06-23 11:57:40
I'm on Win XP Pro SP3, up to date.
I'm not sure what to make of this, since the Download in Block 2 shows that URLMON.DLL is doing something OK... (Comment out Block 1, the CheckURL function, and the Declares for IsValidURL; the Block 2 code runs fine...)
Help?
Thanks,
-John
Code:
'URLMON_test.bas #Compiler PBWin 9 #Compile Exe "URLMON_test.exe" #Dim All #Include "win32api.inc" Declare Function URLDownloadToFile Lib "urlmon.dll" Alias "URLDownloadToFileA" (pCaller As Any, szURL As Asciiz, szFileName As Asciiz, ByVal dwReserved As Dword, ByVal lpfnCB As Dword) As Long #If 10 'not sure if either is correct... Declare Function IsValidUrl Lib "URLMON.DLL" Alias "IsValidUrl" ( _ ByVal LPBC As Asciiz Ptr _ ' /* [in] */ LPBC pbc , ByVal LPCWSTR As Asciiz Ptr _ ' /* [in] */ LPCWSTR szURL , ByVal dwReserved As Dword _ ' /* [in] */ DWORD dwReserved ) As Long ' HRESULT #Else Declare Function IsValidUrl Lib "URLMON.DLL" Alias "IsValidUrl" ( _ ByVal LPBC As Dword _ ' /* [in] */ LPBC pbc , ByVal LPCWSTR As Dword _ ' /* [in] */ LPCWSTR szURL , ByVal dwReserved As Dword _ ' /* [in] */ DWORD dwReserved ) As Long ' HRESULT 'pBC '[in] A pointer to the IBindCtx interface. This parameter is currently ignored. It should be set to NULL. 'szURL '[in] A pointer to a string value that contains the full URL to check. 'dwReserved '[in] Reserved. Must be set to 0. #EndIf Function PBMain As Long Local test, SourceFile, SaveFilename As String, lRet As Long 'Block 1 'test = "http://www.mydomain.com" test = "http://www.mydomain.com/xyz/index.html" If CheckURL(test) = 0 Then MsgBox "is NOT a valid URL",,test Function = %FALSE Else MsgBox "is a valid URL",,test Function = %TRUE End If 'Block 2 'SourceFile = "www.powerbasic.com/index.htm" 'SourceFile = "http://mises.org/story/3290" SourceFile = "http://mises.org/articles.aspx" SaveFilename = "C:\discard_me.htm" lRet = URLDownloadToFile(ByVal 0, ByCopy SourceFile, ByCopy SaveFilename, 0, 0) MsgBox "URL Download to file returned: " & Trim$(Str$(lRet)),,"Download result" End Function Function CheckURL(ByVal URL As String) As Long Local SourceFile As Asciiz * %MAX_PATH Dim pSourceFile As Asciiz Pointer SourceFile = URL pSourceFile = VarPtr(SourceFile) 'is this right? If IsValidURL(0, pSourceFile, 0) = 0 Then 'goes to URLMON.DLL Function = %FALSE 'URL is NOT valid Else Function = %TRUE 'URL is valid End If End Function
Comment