Results 1 to 21 of 21

Thread: InternetOpen Please Help!

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2007
    Posts
    12

    InternetOpen Please Help!

    ....
    Last edited by albertino; Feb 26th, 2007 at 03:52 PM.

  2. #2
    Hyperactive Member
    Join Date
    Oct 2006
    Posts
    354

    Re: InternetOpen Please Help!

    Quote 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:
    1. Const FTP_TRANSFER_TYPE_UNKNOWN = &H0
    2. Const FTP_TRANSFER_TYPE_ASCII = &H1
    3. Const FTP_TRANSFER_TYPE_BINARY = &H2
    4. Const INTERNET_DEFAULT_FTP_PORT = 21               ' default for FTP servers
    5. Const INTERNET_SERVICE_FTP = 1
    6. Const INTERNET_FLAG_PASSIVE = &H8000000            ' used for FTP connections
    7. Const INTERNET_OPEN_TYPE_PRECONFIG = 0                    ' use registry configuration
    8. Const INTERNET_OPEN_TYPE_DIRECT = 1                        ' direct to net
    9. Const INTERNET_OPEN_TYPE_PROXY = 3                         ' via named proxy
    10. Const INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY = 4   ' prevent using java/script/INS
    11. Const MAX_PATH = 260
    12. Private Type FILETIME
    13.     dwLowDateTime As Long
    14.     dwHighDateTime As Long
    15. End Type
    16. Private Type WIN32_FIND_DATA
    17.     dwFileAttributes As Long
    18.     ftCreationTime As FILETIME
    19.     ftLastAccessTime As FILETIME
    20.     ftLastWriteTime As FILETIME
    21.     nFileSizeHigh As Long
    22.     nFileSizeLow As Long
    23.     dwReserved0 As Long
    24.     dwReserved1 As Long
    25.     cFileName As String * MAX_PATH
    26.     cAlternate As String * 14
    27. End Type
    28. Private Declare Function InternetCloseHandle Lib "wininet.dll" (ByVal hInet As Long) As Integer
    29. 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
    30. 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
    31. Private Declare Function FtpSetCurrentDirectory Lib "wininet.dll" Alias "FtpSetCurrentDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean
    32. Private Declare Function FtpGetCurrentDirectory Lib "wininet.dll" Alias "FtpGetCurrentDirectoryA" (ByVal hFtpSession As Long, ByVal lpszCurrentDirectory As String, lpdwCurrentDirectory As Long) As Long
    33. Private Declare Function FtpCreateDirectory Lib "wininet.dll" Alias "FtpCreateDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean
    34. Private Declare Function FtpRemoveDirectory Lib "wininet.dll" Alias "FtpRemoveDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean
    35. Private Declare Function FtpDeleteFile Lib "wininet.dll" Alias "FtpDeleteFileA" (ByVal hFtpSession As Long, ByVal lpszFileName As String) As Boolean
    36. Private Declare Function FtpRenameFile Lib "wininet.dll" Alias "FtpRenameFileA" (ByVal hFtpSession As Long, ByVal lpszExisting As String, ByVal lpszNew As String) As Boolean
    37. 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
    38. 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
    39. Private Declare Function InternetGetLastResponseInfo Lib "wininet.dll" Alias "InternetGetLastResponseInfoA" (lpdwError As Long, ByVal lpszBuffer As String, lpdwBufferLength As Long) As Boolean
    40. 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
    41. Private Declare Function InternetFindNextFile Lib "wininet.dll" Alias "InternetFindNextFileA" (ByVal hFind As Long, lpvFindData As WIN32_FIND_DATA) As Long
    42. Const PassiveConnection As Boolean = True
    43. Private Sub Form_Load()
    44.    
    45.     Dim hConnection As Long, hOpen As Long, sOrgPath  As String
    46.     'open an internet connection
    47.     hOpen = InternetOpen("Microsoft Internet Explorer", INTERNET_OPEN_TYPE_PRECONFIG, vbNullString, vbNullString, 0)
    48.     'connect to the FTP server
    49.     hConnection = InternetConnect(hOpen, "ftp.adress.com", INTERNET_DEFAULT_FTP_PORT, "login", "password", INTERNET_SERVICE_FTP, IIf(PassiveConnection, INTERNET_FLAG_PASSIVE, 0), 0)

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2007
    Posts
    12

    Re: InternetOpen Please Help!

    Please HELP !!!

  4. #4
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    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
    Chris

  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2007
    Posts
    12

    Re: InternetOpen Please Help!

    Quote Originally Posted by the182guy
    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

    I want to download file.txt from ftp using IE. (That firewall didnt pop up).
    How to do that ?

  6. #6

  7. #7

    Thread Starter
    New Member
    Join Date
    Feb 2007
    Posts
    12

    Re: InternetOpen Please Help!


    I need VB6 code sample which automate these procedures

  8. #8
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    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:
    1. 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

  9. #9

    Thread Starter
    New Member
    Join Date
    Feb 2007
    Posts
    12

    Re: InternetOpen Please Help!

    Quote 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:
    1. 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...."...

  10. #10
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: InternetOpen Please Help!

    Use the INet control
    VB Code:
    1. 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

  11. #11

    Thread Starter
    New Member
    Join Date
    Feb 2007
    Posts
    12

    Re: InternetOpen Please Help!

    Quote Originally Posted by Al42
    Use the INet control
    VB Code:
    1. 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 !

  12. #12
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    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

  13. #13

    Thread Starter
    New Member
    Join Date
    Feb 2007
    Posts
    12

    Re: InternetOpen Please Help!

    Quote 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.

  14. #14
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: InternetOpen Please Help!

    Is this firewall popup coming as a result of how your company has configured its internet use?

  15. #15

    Thread Starter
    New Member
    Join Date
    Feb 2007
    Posts
    12

    Re: InternetOpen Please Help!

    Quote 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 ?

  16. #16
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    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.

  17. #17

    Thread Starter
    New Member
    Join Date
    Feb 2007
    Posts
    12

    Re: InternetOpen Please Help!

    Quote Originally Posted by dilettante
    Wake up folks! Active FTP vs. Passive FTP, a Definitive Explanation

    FTP Sessions

    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 ?

  18. #18
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    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.

  19. #19

    Thread Starter
    New Member
    Join Date
    Feb 2007
    Posts
    12

    Re: InternetOpen Please Help!

    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.

    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.

  20. #20
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: InternetOpen Please Help!

    Quote 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

  21. #21

    Thread Starter
    New Member
    Join Date
    Feb 2007
    Posts
    12

    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
  •  



Click Here to Expand Forum to Full Width