Microsoft Internet Transfer Control 6.0 - what would be the API for that ?

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Microsoft Internet Transfer Control 6.0 - what would be the API for that ?

Hi all,
I was really disappointed when I started to write a library (a DLL component)
and I had to add a form only to hold the Microsoft Internet Transfer Control
6.0. Does anyone actually knows if there any API call that can be declared
in the class so that I dont really need to add an additional form.

Re: Microsoft Internet Transfer Control 6.0 - what would be the API for that ?

"Yuri" <uria@cck.com.au> wrote in message news:3b0307be$1@news.devx.com...
>
> Hi all,
> I was really disappointed when I started to write a library (a DLL
component)
> and I had to add a form only to hold the Microsoft Internet Transfer
Control
> 6.0. Does anyone actually knows if there any API call that can be declared
> in the class so that I dont really need to add an additional form.
>
> Your answer would be very much appreciated
>
> Uri
>

Re: Microsoft Internet Transfer Control 6.0 - what would be the API for that ?

"Yuri" <uria@cck.com.au> wrote in message news:3b0307be$1@news.devx.com...
>
> Hi all,
> I was really disappointed when I started to write a library (a DLL
component)
> and I had to add a form only to hold the Microsoft Internet Transfer
Control
> 6.0. Does anyone actually knows if there any API call that can be declared
> in the class so that I dont really need to add an additional form.
>
> Your answer would be very much appreciated
>
> Uri
>

Re: Microsoft Internet Transfer Control 6.0 - what would be the API for that ?

Whilst Michael has given you the correct API, I ought to warn you that there
is quite an amount of overhead when using these functions. It may well be
worth continuing with the Inet control on the form, but also encapsulate
it within the form.

The MSDN documentation _does_ suggest that you can instantiate it like a
class, but in my experience this is highly unstable and almost always crashes
at the first method call.

One alternative may be to buy a 3rd party component. Apparently, the Mabry
internet library is pretty good.

Re: Microsoft Internet Transfer Control 6.0 - what would be the API for that ?

Whilst Michael has given you the correct API, I ought to warn you that there
is quite an amount of overhead when using these functions. It may well be
worth continuing with the Inet control on the form, but also encapsulate
it within the form.

The MSDN documentation _does_ suggest that you can instantiate it like a
class, but in my experience this is highly unstable and almost always crashes
at the first method call.

One alternative may be to buy a 3rd party component. Apparently, the Mabry
internet library is pretty good.

Re: Microsoft Internet Transfer Control 6.0 - what would be the API for that ?

I use the catalyst socketwrench both on a form, and by with early binding (like a class). The site has lots of examples, and is
freeware.
Have a look at www.catalyst.com

--
Dean Earley (dean.earley@icode.co.uk)
Assistant Developer

iCode Systems
"Mark Alexander Bertenshaw" <mark.bertenshaw@virgin.net> wrote in message news:3b03bdc7$1@news.devx.com...
>
> "Michael Shutt" <mshutt@mediaone.net> wrote:
> >You're looking for the WinInet library (wininet.dll). Check out
> ><http://msdn.microsoft.com/workshop/n...et/wininet.asp>
> >
> >--
> >Michael Shutt
>
> Yuri -
>
> Whilst Michael has given you the correct API, I ought to warn you that there
> is quite an amount of overhead when using these functions. It may well be
> worth continuing with the Inet control on the form, but also encapsulate
> it within the form.
>
> The MSDN documentation _does_ suggest that you can instantiate it like a
> class, but in my experience this is highly unstable and almost always crashes
> at the first method call.
>
> One alternative may be to buy a 3rd party component. Apparently, the Mabry
> internet library is pretty good.
>
> --
> Mark Alexander Bertenshaw
> Programmer/Analyst
> Chordiant Software, Inc.
> Brentford
> UK
>

Re: Microsoft Internet Transfer Control 6.0 - what would be the API for that ?

I use the catalyst socketwrench both on a form, and by with early binding (like a class). The site has lots of examples, and is
freeware.
Have a look at www.catalyst.com

--
Dean Earley (dean.earley@icode.co.uk)
Assistant Developer

iCode Systems
"Mark Alexander Bertenshaw" <mark.bertenshaw@virgin.net> wrote in message news:3b03bdc7$1@news.devx.com...
>
> "Michael Shutt" <mshutt@mediaone.net> wrote:
> >You're looking for the WinInet library (wininet.dll). Check out
> ><http://msdn.microsoft.com/workshop/n...et/wininet.asp>
> >
> >--
> >Michael Shutt
>
> Yuri -
>
> Whilst Michael has given you the correct API, I ought to warn you that there
> is quite an amount of overhead when using these functions. It may well be
> worth continuing with the Inet control on the form, but also encapsulate
> it within the form.
>
> The MSDN documentation _does_ suggest that you can instantiate it like a
> class, but in my experience this is highly unstable and almost always crashes
> at the first method call.
>
> One alternative may be to buy a 3rd party component. Apparently, the Mabry
> internet library is pretty good.
>
> --
> Mark Alexander Bertenshaw
> Programmer/Analyst
> Chordiant Software, Inc.
> Brentford
> UK
>

Re: Microsoft Internet Transfer Control 6.0 - what would be the API for that ?

The Internet Transfer control is just a wrapper for the WinInet API, so any
overhead you incur with wininet.dll will just be increased by using
msinet.ocx.

--
Michael Shutt

Please respond to newsgroup as I will not return direct emails.

"Mark Alexander Bertenshaw" <mark.bertenshaw@virgin.net> wrote in message
news:3b03bdc7$1@news.devx.com...
>
> "Michael Shutt" <mshutt@mediaone.net> wrote:
> >You're looking for the WinInet library (wininet.dll). Check out
> ><http://msdn.microsoft.com/workshop/n...et/wininet.asp>
> >
> >--
> >Michael Shutt
>
> Yuri -
>
> Whilst Michael has given you the correct API, I ought to warn you that
there
> is quite an amount of overhead when using these functions. It may well be
> worth continuing with the Inet control on the form, but also encapsulate
> it within the form.
>
> The MSDN documentation _does_ suggest that you can instantiate it like a
> class, but in my experience this is highly unstable and almost always
crashes
> at the first method call.
>
> One alternative may be to buy a 3rd party component. Apparently, the
Mabry
> internet library is pretty good.
>
> --
> Mark Alexander Bertenshaw
> Programmer/Analyst
> Chordiant Software, Inc.
> Brentford
> UK
>

Re: Microsoft Internet Transfer Control 6.0 - what would be the API for that ?

The Internet Transfer control is just a wrapper for the WinInet API, so any
overhead you incur with wininet.dll will just be increased by using
msinet.ocx.

--
Michael Shutt

Please respond to newsgroup as I will not return direct emails.

"Mark Alexander Bertenshaw" <mark.bertenshaw@virgin.net> wrote in message
news:3b03bdc7$1@news.devx.com...
>
> "Michael Shutt" <mshutt@mediaone.net> wrote:
> >You're looking for the WinInet library (wininet.dll). Check out
> ><http://msdn.microsoft.com/workshop/n...et/wininet.asp>
> >
> >--
> >Michael Shutt
>
> Yuri -
>
> Whilst Michael has given you the correct API, I ought to warn you that
there
> is quite an amount of overhead when using these functions. It may well be
> worth continuing with the Inet control on the form, but also encapsulate
> it within the form.
>
> The MSDN documentation _does_ suggest that you can instantiate it like a
> class, but in my experience this is highly unstable and almost always
crashes
> at the first method call.
>
> One alternative may be to buy a 3rd party component. Apparently, the
Mabry
> internet library is pretty good.
>
> --
> Mark Alexander Bertenshaw
> Programmer/Analyst
> Chordiant Software, Inc.
> Brentford
> UK
>

Re: Microsoft Internet Transfer Control 6.0 - what would be the API for that ?

"Michael Shutt" <mshutt@mediaone.net> wrote in message
news:3b0400cb$1@news.devx.com...
> The Internet Transfer control is just a wrapper for the WinInet API, so
any
> overhead you incur with wininet.dll will just be increased by using
> msinet.ocx.
>
> --
> Michael Shutt

Quite true, but you still have to write code to interface with the WinInet
DLL which in itself is an overhead. I suppose it depends on how much of the
DLL's features you require.

Re: Microsoft Internet Transfer Control 6.0 - what would be the API for that ?

"Michael Shutt" <mshutt@mediaone.net> wrote in message
news:3b0400cb$1@news.devx.com...
> The Internet Transfer control is just a wrapper for the WinInet API, so
any
> overhead you incur with wininet.dll will just be increased by using
> msinet.ocx.
>
> --
> Michael Shutt

Quite true, but you still have to write code to interface with the WinInet
DLL which in itself is an overhead. I suppose it depends on how much of the
DLL's features you require.

Re: Microsoft Internet Transfer Control 6.0 - what would be the API for that ?

I feel your pain Yuri =). I get so frustrated with that crap -- half the
things written as "controls" should really be a DLL. Oh well.

It's really not too difficult to use the winnet, and it works "well enough"
for most cases (which is exactly what the control uses). 3RD party DLL's
doesn't really mean "better" -- if you start banging on them hard enough
they too can crumble. Wininet sure beats beats writing to the RFC's.

Below please find an *example* routine that downloads an URL (FTP or HTTP).
The subject example performs a UUEncode of the input file before writing it
to an output file, but you can modify it to suit your needs. You will need
to fetch the declares too.

I've also included a little file (CheckSumFiles.EXE) which is helpfull when
you are writing code that performs a file copy -- it ensures that the file
is identical to the source.

' Notify caller if failed
If Not IsValidHandle(hInternet) Then
ApiRaise Err.LastDllError, Module, "Could not connect to the
internet."
End If

' Open the file.
If LCase$(ProtocolName) Like "ftp:*" Then

' An empty UserID is NULL.
If Len(UserName) = 0 Then
UserName = vbNullString
' We only NULL the password if both are empty strings,
' otherwise it's legal to have an empty string as a
' password.
If Len(Password) = 0 Then
Password = vbNullString
End If
End If

' For FTP, we must first connect to the FTP server
' before we can open the file.
hFTP = InternetConnect(hInternet, ProtocolName & ServerName, _
INTERNET_INVALID_PORT_NUMBER, UserName, Password, _
INTERNET_SERVICE_FTP, _
IIf(Passive, INTERNET_FLAG_PASSIVE, 0), 0)

If Not IsValidHandle(hFTP) Then
ApiRaise Err.LastDllError, Module, _
"Could not connect to FTP server " & ServerName & "."
End If

' Change the current directory. My experience
' reveals that this is better than using a
' full path spec in FtpOpenFile.
Success = FtpSetCurrentDirectory(hFTP, _
IIf(Len(FolderName) = 0, "/", FolderName))
If Not Success Then
ApiRaise Err.LastDllError, Module, _
"Could not set current directory to " & FolderName & "."
End If

'*************************************************
' This section reads the file. A double loop is
' needed cuz we download the file in ~4K chunks.
' For each chunk, we will encode 1 45-byte line at
' a time. We do this cuz downloading a file 45
' bytes at a time sux. 4-8K is optimal for a slow
' WAN (or dialup) connection.
'*************************************************

' Reduce size if last line and not full length.
' Otherwise, encode a full chunk, using default
' stuff set before the loop.
If (cbPgRead - cbEncoded) < UUChunkSize Then
cbToEncode = (cbPgRead - cbEncoded)
Prefix = Chr$((cbPgRead - cbEncoded) + 32)
ReDim BufferIn(cbToEncode - 1)
End If

' Close connections. Bottom up since
' InternetCloseHandle will recurse.
If IsValidHandle(hFile) Then
InternetCloseHandle hFile
End If
If IsValidHandle(hInternet) Then
InternetCloseHandle hInternet
End If

' Throw error to caller if any
If nErr <> 0 Then
On Error GoTo 0
Err.Raise nErr, Module, sErr
End If

"Yuri" <uria@cck.com.au> wrote in message news:3b0307be$1@news.devx.com...
>
> Hi all,
> I was really disappointed when I started to write a library (a DLL
component)
> and I had to add a form only to hold the Microsoft Internet Transfer
Control
> 6.0. Does anyone actually knows if there any API call that can be declared
> in the class so that I dont really need to add an additional form.
>
> Your answer would be very much appreciated
>
> Uri
>

Re: Microsoft Internet Transfer Control 6.0 - what would be the API for that ?

I feel your pain Yuri =). I get so frustrated with that crap -- half the
things written as "controls" should really be a DLL. Oh well.

It's really not too difficult to use the winnet, and it works "well enough"
for most cases (which is exactly what the control uses). 3RD party DLL's
doesn't really mean "better" -- if you start banging on them hard enough
they too can crumble. Wininet sure beats beats writing to the RFC's.

Below please find an *example* routine that downloads an URL (FTP or HTTP).
The subject example performs a UUEncode of the input file before writing it
to an output file, but you can modify it to suit your needs. You will need
to fetch the declares too.

I've also included a little file (CheckSumFiles.EXE) which is helpfull when
you are writing code that performs a file copy -- it ensures that the file
is identical to the source.

' Notify caller if failed
If Not IsValidHandle(hInternet) Then
ApiRaise Err.LastDllError, Module, "Could not connect to the
internet."
End If

' Open the file.
If LCase$(ProtocolName) Like "ftp:*" Then

' An empty UserID is NULL.
If Len(UserName) = 0 Then
UserName = vbNullString
' We only NULL the password if both are empty strings,
' otherwise it's legal to have an empty string as a
' password.
If Len(Password) = 0 Then
Password = vbNullString
End If
End If

' For FTP, we must first connect to the FTP server
' before we can open the file.
hFTP = InternetConnect(hInternet, ProtocolName & ServerName, _
INTERNET_INVALID_PORT_NUMBER, UserName, Password, _
INTERNET_SERVICE_FTP, _
IIf(Passive, INTERNET_FLAG_PASSIVE, 0), 0)

If Not IsValidHandle(hFTP) Then
ApiRaise Err.LastDllError, Module, _
"Could not connect to FTP server " & ServerName & "."
End If

' Change the current directory. My experience
' reveals that this is better than using a
' full path spec in FtpOpenFile.
Success = FtpSetCurrentDirectory(hFTP, _
IIf(Len(FolderName) = 0, "/", FolderName))
If Not Success Then
ApiRaise Err.LastDllError, Module, _
"Could not set current directory to " & FolderName & "."
End If

'*************************************************
' This section reads the file. A double loop is
' needed cuz we download the file in ~4K chunks.
' For each chunk, we will encode 1 45-byte line at
' a time. We do this cuz downloading a file 45
' bytes at a time sux. 4-8K is optimal for a slow
' WAN (or dialup) connection.
'*************************************************

' Reduce size if last line and not full length.
' Otherwise, encode a full chunk, using default
' stuff set before the loop.
If (cbPgRead - cbEncoded) < UUChunkSize Then
cbToEncode = (cbPgRead - cbEncoded)
Prefix = Chr$((cbPgRead - cbEncoded) + 32)
ReDim BufferIn(cbToEncode - 1)
End If

' Close connections. Bottom up since
' InternetCloseHandle will recurse.
If IsValidHandle(hFile) Then
InternetCloseHandle hFile
End If
If IsValidHandle(hInternet) Then
InternetCloseHandle hInternet
End If

' Throw error to caller if any
If nErr <> 0 Then
On Error GoTo 0
Err.Raise nErr, Module, sErr
End If

"Yuri" <uria@cck.com.au> wrote in message news:3b0307be$1@news.devx.com...
>
> Hi all,
> I was really disappointed when I started to write a library (a DLL
component)
> and I had to add a form only to hold the Microsoft Internet Transfer
Control
> 6.0. Does anyone actually knows if there any API call that can be declared
> in the class so that I dont really need to add an additional form.
>
> Your answer would be very much appreciated
>
> Uri
>