Results 1 to 5 of 5

Thread: FTP using .Net (Not Inet)

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2001
    Location
    nr Manchester, England
    Posts
    34

    FTP using .Net (Not Inet)

    Has anyone tried building a VB.Net FTP object?

    I've managed to build one in VB6, but need to create it using VB.Net.

    The problem I'm getting is both VB6 and VB.Net return the same handle for the InternetOpen API call, but different handles for the InternetConnect API call.

    The handle returned by the .Net seems excessively large too!

    I don't understand why the same API function (with the same parameters) should return different values in VB6 and VB.Net

    Please, please, please help

    -Rob

  2. #2
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    Did you think about changing a Long to an Integer in the API declarations?

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 2001
    Location
    nr Manchester, England
    Posts
    34
    Thanx for the speedy reply

    If I change the Long to an Integer in the API declaration, the function then returns 0, and therefore appears to break it.

    The connection number returned when using a Long is 7135819915826561024, which seems ok, but raises errors in subsequent API calls - Invalid Handle.

  4. #4

    Thread Starter
    Member
    Join Date
    Aug 2001
    Location
    nr Manchester, England
    Posts
    34
    The actual declaration that's causing the problems is here:-

    Public Declare Function FtpSetCurrentDirectory Lib "wininet.dll" _
    Alias "FtpSetCurrentDirectoryA" _
    (ByVal hConnect As Long, _
    ByVal lpszDirectory As String) As Boolean

    I'm passing hconnect as 7135819915826561024, and lpszDirectory as "/FTPFolder/".

    The function returns false in VB.Net, but this works in VB6 and returns true !?!?!?!

  5. #5
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    In VB.NET a long is 64 bit, while all API functions expect 32 bit integers. All VB6 Longs should be replaced by integers (and not only the return values).

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