|
-
Apr 13th, 2008, 09:36 AM
#1
Thread Starter
Fanatic Member
Urlmon and Wininet
Hello, as I am developing a VB6 application thta contains the following API declarations:
Code:
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
Private Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" (ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As String, ByVal sProxyBypass As String, ByVal lFlags As Long) As Long
I was wondering whether I must make sure that urlmon and wininet are on the user's computer or I can take it for granted. In other words, are the two libraries above an integral part of Windows? If yes, since when have they been shipped with the OS?
TIA
Since I discovered Delphi and Lazarus, VB has become history to me.
-
Apr 13th, 2008, 11:13 AM
#2
Re: Urlmon and Wininet
Only way to be sure is to try it, I don't believe you do since those libraries should come already installed with Windows. However, when creating an installation package using those API functions using VB's Package & Deployment Wizard, it adds those files to the support folder.
URLDownloadToFile:
Operating Systems Supported
Requires Windows NT 4.0 or later; Requires Windows 95 or later
InternetOpen:
Operating Systems Supported
Requires Windows NT 4.0 or later; Win9x/ME: Not supported
Taken from:
http://allapi.mentalis.org/apilist
-
Apr 14th, 2008, 05:41 AM
#3
Thread Starter
Fanatic Member
Re: Urlmon and Wininet
 Originally Posted by DigiRev
Only way to be sure is to try it, I don't believe you do since those libraries should come already installed with Windows. However, when creating an installation package using those API functions using VB's Package & Deployment Wizard, it adds those files to the support folder.
URLDownloadToFile:
Operating Systems Supported
Requires Windows NT 4.0 or later; Requires Windows 95 or later
InternetOpen:
Operating Systems Supported
Requires Windows NT 4.0 or later; Win9x/ME: Not supported
Taken from:
http://allapi.mentalis.org/apilist
Thanks. I don't understand what they mean by "not supported". In particular, it is unclear to me whether it means that Win9X is not equipped with that library or you cannot install that library on Win9X. Any idea?
Since I discovered Delphi and Lazarus, VB has become history to me.
-
Apr 14th, 2008, 06:57 AM
#4
Re: Urlmon and Wininet
You can install the library on anything you want. However, if the OS on which it is installed does not support the functionality included in the source code of these DLLs, then using them is not possible.
That is what they mean.
9X does not support the functionality.
-
Apr 20th, 2008, 11:01 AM
#5
Thread Starter
Fanatic Member
Re: Urlmon and Wininet
Is there any way I can make the code below compatible with Win 98 and Me? In other words, is it possible to make a different API call (no OCX's) to get the same result under Win 98 and Me?
Code:
Option Explicit
Private Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" (ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As String, ByVal sProxyBypass As String, ByVal lFlags As Long) As Long
Private Declare Function InternetOpenUrl Lib "wininet.dll" Alias "InternetOpenUrlA" (ByVal hInternetSession As Long, ByVal sURL As String, ByVal sHeaders As String, ByVal lHeadersLength As Long, ByVal lFlags As Long, ByVal lContext As Long) As Long
Private Declare Function InternetReadFile Lib "wininet.dll" (ByVal hFile As Long, ByVal sBuffer As String, ByVal lNumBytesToRead As Long, lNumberOfBytesRead As Long) As Integer
Private Declare Function InternetCloseHandle Lib "wininet.dll" (ByVal hInet As Long) As Integer
Private Declare Function GetInputState Lib "user32" () As Long
Private Const IF_NO_CACHE_WRITE = &H4000000
Private Const BUFFER_LEN = 256
Private Function URLSource(ByRef URL As String) As String
Dim strBuffer As String * BUFFER_LEN, lonRet As Long
Dim strData As String, lonHandle As Long, lonSession As Long
Dim lonResult As Long
lonSession = InternetOpen("vb wininet", 1, vbNullString, vbNullString, 0)
If lonSession Then lonHandle = InternetOpenUrl(lonSession, URL, vbNullString, 0, IF_NO_CACHE_WRITE, 0)
If lonHandle Then
lonResult = InternetReadFile(lonHandle, strBuffer, BUFFER_LEN, lonRet)
strData = strBuffer
Do While lonRet <> 0
lonResult = InternetReadFile(lonHandle, strBuffer, BUFFER_LEN, lonRet)
strData = strData & Mid$(strBuffer, 1, lonRet)
If GetInputState Then DoEvents
Loop
End If
lonResult = InternetCloseHandle(lonHandle)
URLSource = strData
End Function
Thanks in advance.
Since I discovered Delphi and Lazarus, VB has become history to me.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|