Something like this ? This connects to an FTP server...
VB Code:
Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Declare Function InternetOpen Lib "wininet" 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 InternetConnect Lib "wininet.dll" Alias "InternetConnectA" (ByVal hInternetSession _
As Long, ByVal sServerName As String, ByVal nServerPort As Integer, ByVal sUserName As String, _
ByVal sPassword As String, ByVal lService As Long, ByVal lFlags As Long, ByVal lContext As Long) _
As Long
Private Declare Function InternetCloseHandle Lib "wininet" (ByVal hInet As Long) As Integer
Ret = GetSystemDirectory(FTPDir, 255)
FTPDir = Left$(FTPDir, Ret)
If Ret > 0 Then
FTPDir = FTPDir & "\FTP.exe"
Else
MsgBox "Error in FTP..... exiting!"
Exit Sub
End If
'Open our connection
IOpen = InternetOpen(FTPDir, 0, vbNullString, vbNullString, 0)
IConnect = InternetConnect(IOpen, Me.txtAddress, 21, Me.txtUser, Me.txtPassword, 1, INTERNET_FLAG_PASSIVE, 0)
If IOpen = 0 Or IConnect = 0 Then
MsgBox "Could not open connection to : " & Me.txtAddress
InternetCloseHandle IConnect
InternetCloseHandle IOpen
Exit Sub
End If