dcsimg
Results 1 to 3 of 3

Thread: err.LastDllError=6 after call to InternetConnect in wininet.dll

  1. #1

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    Sitting in an empty room trying to forget the past
    Posts
    4,111

    err.LastDllError=6 after call to InternetConnect in wininet.dll

    This may be my first time posting to the VB6 forum! Or maybe I've posted before and forgot, but I'm sure it would have been memorable.

    I am working with code that has an error but used to work. It is trying to call InternetOpen and InternetConnect in wininet.dll. The Open call works and returns a valid handle, but when I call InternetConnect a zero is returned and my error handler is called. All my code was telling me was a customized message "Cannot connect to server[FTP]" but I wanted to know what that really meant so I queried err.LastDllError and it says 6. How can I pin this down further? Most codes are 12000 plus, is that correct?

    Thanks.
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,135

    Re: err.LastDllError=6 after call to InternetConnect in wininet.dll

    I haven't tested it but give it a try anyway - hopefully it'll work for you:
    Code:
    Option Explicit
    
    Private Const LANG_NEUTRAL = &H0
    Private Const FORMAT_MESSAGE_FROM_SYSTEM = &H1000
    
    Private Declare Function GetLastError Lib "kernel32" () As Long
    Private Declare Function FormatMessage Lib "kernel32" Alias "FormatMessageA" _
        (ByVal dwFlags As Long, lpSource As Any, ByVal dwMessageId As Long, _
        ByVal dwLanguageId As Long, ByVal lpBuffer As String, ByVal nSize As Long, Arguments As Long) As Long
    
    Private Sub Form_Load()
    Dim res As Long
    Dim buffer As String
    
        buffer = Space(1024)
        
        res = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, ByVal 0&, GetLastError, LANG_NEUTRAL, buffer, 200, ByVal 0&)
        MsgBox Replace(buffer, Chr(0), "")
    
    End Sub
    NOTE: you'd want to add that code to your error handler I guess.

  3. #3

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    Sitting in an empty room trying to forget the past
    Posts
    4,111

    Re: err.LastDllError=6 after call to InternetConnect in wininet.dll

    Thank you, I will try that. In the meantime, I tried changing the value of the ftp host because I wasn't sure it was correct (I think it may have changed), and I got errors in the 12000 range, which was more what I was expecting. So maybe I will troubleshoot along this route.
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width