|
-
Feb 16th, 2007, 03:59 PM
#1
Thread Starter
New Member
InternetOpen Please Help!
Last edited by albertino; Feb 26th, 2007 at 03:52 PM.
-
Feb 16th, 2007, 10:55 PM
#2
Hyperactive Member
Re: InternetOpen Please Help!
 Originally Posted by albertino
Hellow,
I m using this VB6 sample to connect to ftp. How to make connect as/frew Internet Explorer ? (What will not firewall pop up) :
What the does this sentence mean?
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)
-
Feb 17th, 2007, 03:49 AM
#3
Thread Starter
New Member
Re: InternetOpen Please Help!
-
Feb 17th, 2007, 08:49 AM
#4
Re: InternetOpen 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
-
Feb 18th, 2007, 05:56 AM
#5
Thread Starter
New Member
Re: InternetOpen Please Help!
 Originally Posted by the182guy
I want to download file.txt from ftp using IE. (That firewall didnt pop up).
How to do that ?
-
Feb 18th, 2007, 12:29 PM
#6
Hyperactive Member
Re: InternetOpen Please Help!
-
Feb 18th, 2007, 03:45 PM
#7
Thread Starter
New Member
Re: InternetOpen Please Help!
 Originally Posted by superbovine
I need VB6 code sample which automate these procedures
-
Feb 19th, 2007, 02:28 PM
#8
Re: InternetOpen Please Help!
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 file
VB Code:
WebBrowser1.Navigate "http://www.mysite.com/file.exe"
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Feb 20th, 2007, 02:39 AM
#9
Thread Starter
New Member
Re: InternetOpen Please Help!
 Originally Posted by Al42
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 file
VB Code:
WebBrowser1.Navigate "http://www.mysite.com/file.exe"
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...."...
-
Feb 20th, 2007, 12:49 PM
#10
Re: InternetOpen Please Help!
Use the INet control
VB Code:
Inet1.Execute , "GET " & Chr(34) & RemotePath & "\" & RemoteFileName & Chr(34) & " " & Chr(34) & LocalPath & "\" & LocalFileName & Chr(34)
will download RemotePath & "\" & RemoteFileName to LocalPath & "\" & LocalFileName. You can use Inet1.StillExecuting to find out when the download is complete.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Feb 22nd, 2007, 05:08 AM
#11
Thread Starter
New Member
Re: InternetOpen Please Help!
 Originally Posted by Al42
Use the INet control
VB Code:
Inet1.Execute , "GET " & Chr(34) & RemotePath & "\" & RemoteFileName & Chr(34) & " " & Chr(34) & LocalPath & "\" & LocalFileName & Chr(34)
will download RemotePath & "\" & RemoteFileName to LocalPath & "\" & LocalFileName. You can use Inet1.StillExecuting to find out when the download is complete.
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 !
-
Feb 22nd, 2007, 05:47 PM
#12
Re: InternetOpen 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.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Feb 23rd, 2007, 09:55 AM
#13
Thread Starter
New Member
Re: InternetOpen Please Help!
 Originally Posted by Al42
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 and
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) : ???
Last edited by albertino; Feb 23rd, 2007 at 10:01 AM.
-
Feb 23rd, 2007, 02:09 PM
#14
Re: InternetOpen Please Help!
Is this firewall popup coming as a result of how your company has configured its internet use?
-
Feb 24th, 2007, 04:03 AM
#15
Thread Starter
New Member
Re: InternetOpen Please Help!
 Originally Posted by Hack
Is this firewall popup coming as a result of how your company has configured its internet use?
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 ?
-
Feb 25th, 2007, 02:41 AM
#16
Re: InternetOpen Please Help!
Wake up folks! Active FTP vs. Passive FTP, a Definitive Explanation
For passive FTP semantics, the application must also set the INTERNET_FLAG_PASSIVE flag.
FTP Sessions
Hint:
Either your code isn't quite working to set the flag properly or the server is rejecting passive FTP.
Last edited by dilettante; Feb 25th, 2007 at 02:49 AM.
-
Feb 25th, 2007, 11:47 AM
#17
Thread Starter
New Member
Re: InternetOpen Please Help!
 Originally Posted by dilettante
YES this is THAT i need! THANK YOU! maybe YOU can write short example/sample ? How to download in pasive mode from ftp ?
-
Feb 25th, 2007, 03:27 PM
#18
Re: InternetOpen Please Help!
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.
-
Feb 26th, 2007, 05:28 AM
#19
Thread Starter
New Member
Re: InternetOpen Please Help!
 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.
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 ????
Last edited by albertino; Feb 26th, 2007 at 03:47 PM.
-
Feb 26th, 2007, 02:51 PM
#20
Re: InternetOpen Please Help!
 Originally Posted by albertino
And i thought that if i connect to ftp frew IE it will be invisible to firewall?
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.
How to do connection invisible to firewall ?
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.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Feb 26th, 2007, 03:49 PM
#21
Thread Starter
New Member
Re: InternetOpen Please Help!
Thank You All For Help !!!
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
|