....
Printable View
....
What the does this sentence mean?Quote:
Originally Posted by albertino
use vbcode tags next time
VB Code:
Const FTP_TRANSFER_TYPE_UNKNOWN = &H0 Const FTP_TRANSFER_TYPE_ASCII = &H1 Const FTP_TRANSFER_TYPE_BINARY = &H2 Const INTERNET_DEFAULT_FTP_PORT = 21 ' default for FTP servers Const INTERNET_SERVICE_FTP = 1 Const INTERNET_FLAG_PASSIVE = &H8000000 ' used for FTP connections Const INTERNET_OPEN_TYPE_PRECONFIG = 0 ' use registry configuration Const INTERNET_OPEN_TYPE_DIRECT = 1 ' direct to net Const INTERNET_OPEN_TYPE_PROXY = 3 ' via named proxy Const INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY = 4 ' prevent using java/script/INS Const MAX_PATH = 260 Private Type FILETIME dwLowDateTime As Long dwHighDateTime As Long End Type Private Type WIN32_FIND_DATA dwFileAttributes As Long ftCreationTime As FILETIME ftLastAccessTime As FILETIME ftLastWriteTime As FILETIME nFileSizeHigh As Long nFileSizeLow As Long dwReserved0 As Long dwReserved1 As Long cFileName As String * MAX_PATH cAlternate As String * 14 End Type Private Declare Function InternetCloseHandle Lib "wininet.dll" (ByVal hInet As Long) As Integer 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 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 FtpSetCurrentDirectory Lib "wininet.dll" Alias "FtpSetCurrentDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean Private Declare Function FtpGetCurrentDirectory Lib "wininet.dll" Alias "FtpGetCurrentDirectoryA" (ByVal hFtpSession As Long, ByVal lpszCurrentDirectory As String, lpdwCurrentDirectory As Long) As Long Private Declare Function FtpCreateDirectory Lib "wininet.dll" Alias "FtpCreateDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean Private Declare Function FtpRemoveDirectory Lib "wininet.dll" Alias "FtpRemoveDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean Private Declare Function FtpDeleteFile Lib "wininet.dll" Alias "FtpDeleteFileA" (ByVal hFtpSession As Long, ByVal lpszFileName As String) As Boolean Private Declare Function FtpRenameFile Lib "wininet.dll" Alias "FtpRenameFileA" (ByVal hFtpSession As Long, ByVal lpszExisting As String, ByVal lpszNew As String) As Boolean Private Declare Function FtpGetFile Lib "wininet.dll" Alias "FtpGetFileA" (ByVal hConnect As Long, ByVal lpszRemoteFile As String, ByVal lpszNewFile As String, ByVal fFailIfExists As Long, ByVal dwFlagsAndAttributes As Long, ByVal dwFlags As Long, ByRef dwContext As Long) As Boolean Private Declare Function FtpPutFile Lib "wininet.dll" Alias "FtpPutFileA" (ByVal hConnect As Long, ByVal lpszLocalFile As String, ByVal lpszNewRemoteFile As String, ByVal dwFlags As Long, ByVal dwContext As Long) As Boolean Private Declare Function InternetGetLastResponseInfo Lib "wininet.dll" Alias "InternetGetLastResponseInfoA" (lpdwError As Long, ByVal lpszBuffer As String, lpdwBufferLength As Long) As Boolean Private Declare Function FtpFindFirstFile Lib "wininet.dll" Alias "FtpFindFirstFileA" (ByVal hFtpSession As Long, ByVal lpszSearchFile As String, lpFindFileData As WIN32_FIND_DATA, ByVal dwFlags As Long, ByVal dwContent As Long) As Long Private Declare Function InternetFindNextFile Lib "wininet.dll" Alias "InternetFindNextFileA" (ByVal hFind As Long, lpvFindData As WIN32_FIND_DATA) As Long Const PassiveConnection As Boolean = True Private Sub Form_Load() Dim hConnection As Long, hOpen As Long, sOrgPath As String 'open an internet connection hOpen = InternetOpen("Microsoft Internet Explorer", INTERNET_OPEN_TYPE_PRECONFIG, vbNullString, vbNullString, 0) 'connect to the FTP server hConnection = InternetConnect(hOpen, "ftp.adress.com", INTERNET_DEFAULT_FTP_PORT, "login", "password", INTERNET_SERVICE_FTP, IIf(PassiveConnection, INTERNET_FLAG_PASSIVE, 0), 0)
Please HELP !!!
What do you want to do with FTP? If you want to upload a file try this code with the Inet control:
http://vbforums.com/showpost.php?p=2769773&postcount=10
Quote:
Originally Posted by the182guy
I want to download file.txt from ftp using IE. (That firewall didnt pop up).
How to do that ?
Quote:
Originally Posted by superbovine
I need VB6 code sample which automate these procedures
Put a WebBrowser control on the form (you can make it very small or put it behind some other control so it won't show) and navigate it to the fileVB Code:
WebBrowser1.Navigate "http://www.mysite.com/file.exe"
Quote:
Originally Posted by Al42
Thanx for trying, but i need sample to download file from ftp, NOT web site.
and i want what download will be automated and in the backgruond,with Your code sample will pop up windows asking "Open save chansel...."...
Use the INet controlwill download RemotePath & "\" & RemoteFileName to LocalPath & "\" & LocalFileName. You can use Inet1.StillExecuting to find out when the download is complete.VB Code:
Inet1.Execute , "GET " & Chr(34) & RemotePath & "\" & RemoteFileName & Chr(34) & " " & Chr(34) & LocalPath & "\" & LocalFileName & Chr(34)
Quote:
Originally Posted by Al42
As I write before "How to make connect as/frew Internet Explorer ? (What will not firewall pop up/show dialog box) : ???
I know its hard question, but please help !
Make a decision: Do you want to download without a couple of boxes popping up or do you want to download by running Internet Explorer? If you use IE, you'll get a box popping up asking if you want to open the file or save it and, if you want to save it, another box will pop up asking where you want to save it.
Sorry for my english....It maybe hard to understand me....Im using VB6 andQuote:
Originally Posted by Al42
I want to download file from ftp automated mode/without boxes popping up by running Internet Explorer and didnt pop up win xp firewall box! (Main idea is how download file without win xp firewall pop up asking(yes no ...or...).
As I write before "How to make connect as/frew Internet Explorer ? (What will NOT Win XP firewall pop up/show dialog box) : ???
Is this firewall popup coming as a result of how your company has configured its internet use?
Quote:
Originally Posted by Hack
No. Its windows xp firewal....It can be another software...but I wrote what
if i'll use internet explorer to download file from FTP, firewall didnt pop up...How to do what in VB6 ?
Wake up folks! ;) Active FTP vs. Passive FTP, a Definitive Explanation
FTP SessionsQuote:
For passive FTP semantics, the application must also set the INTERNET_FLAG_PASSIVE flag.
Hint:
Either your code isn't quite working to set the flag properly or the server is rejecting passive FTP.
YES this is THAT i need! THANK YOU! maybe YOU can write short example/sample ? How to download in pasive mode from ftp ?Quote:
Originally Posted by dilettante
The code you already listed looks good. As I wrote earlier there must be some small error, or maybe your FTP server doesn't want to do passive mode FTP?
Here's a known working sample program:
SAMPLE: VBFTP.EXE: Implementing FTP Using WinInet API from VB
Try this to make sure it works as you require. Then look at the code to see what you need to do in your own program.
Quote:
Originally Posted by dilettante
When im trying this sample i ALWAYS get error "internet connection error 12029 and 12007... i checked this : http://firstclass2.com/problem7.htm
I turn off win xp firewall and still get this msg......
With ie config evrythig allright...
how to connect in that way what firewall doesnt pop up/stop my trasfer ????
It will be for outgoing connections. It won't be for incoming connections through a firewall that blocks incoming connections (like Windows XP firewall). It won't be invisible in either direction for a firewall that blocks both directions, like Zone Alarm.Quote:
Originally Posted by albertino
Use a passive ftp connection - that's outgoing. Ftp is normally incoming. That'll make it invisible to a firewall that's blocking incoming connections.Quote:
How to do connection invisible to firewall ?
Thank You All For Help !!!