Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

WININET.DLL

12 views
Skip to first unread message

Azmizar Ujang

unread,
Jun 30, 1999, 3:00:00 AM6/30/99
to

Hi,

I'm currently trying to write a class module to do FTP functions by using the WININET.DLL APIs. My only problem is, after one of my functions fails, I'm not able to get the error message.

Ex:
I killed the user connection from my server side and then try to use FTPSetCurrentDirectoryA(). The function returns 0 as expected and ERR.LASTDLLERR returns ERROR_INTERNET_EXTENDED_ERROR. From MSDN, I should be able to use InternetGetLastResponseInfo() call to get the error response but it keeps failing (returns 0).

Here is my declaration of InternetGetLastResponseInfo():
Private Declare Function InternetGetLastResponseInfo Lib "wininet.dll" Alias "InternetGetLastResponseInfoA" (ByVal lpdwError As Long, ByRef lpszBuffer As String, ByRef lpdwBufferLength As Long) As Long

Here is a function to retrieve the error message:
Private Sub GetLastInfo()
Dim hRet As Long
Dim strMessage As String
Dim lngTestSz As Long
Dim lngErrorCode As Long

lngTestSz = 1024
strMessage = String(lngTestSz, Chr(0))

hRet = InternetGetLastResponseInfo(lngErrorCode, strMessage, lngTestSz)
If (hRet = 0) Then
' do something to display the error message on the error of using InternetGetLastResponseInfo() function
else
' copy over the error message to class errorstring variable
end if
End Sub

Ultimately, I would like to detect if the server has dropped my connection (idle timeout or someone kills the connection). I thought the error message should help.

Help is greatly appreciated.

Regards,
-Azmizar

-----------------** -- Posted from CodeGuru -- **-----------------
http://www.codeguru.com/vb The website for VB programmers.

Oleg Gdalevich

unread,
Jul 8, 1999, 3:00:00 AM7/8/99
to
Hello Azmizar,

Try this.


Function GetResponse() As String

Dim dwIntError As Long
Dim dwLength As Long
Dim strBuffer As String

InternetGetLastResponseInfo dwIntError, vbNullString, dwLength
strBuffer = String(dwLength + 1, 0)

InternetGetLastResponseInfo dwIntError, strBuffer, dwLength
GetResponse = strBuffer

End Function

--
Oleg Gdalevich, MCSD
St.Petersburg, Russia
E-mail: gd...@comset.net, ge...@hotmail.com

VBRusNet Visual Basic Russian Site http://vbrusnet.hypermart.net/

Azmizar Ujang <azmiza...@intel.com> wrote in message
news:3779f...@209.66.99.126...

daus_...@yahoo.com

unread,
Mar 20, 2013, 3:32:14 AM3/20/13
to Azmizar Ujang
0 new messages