Private function ErrorOut(ByVal dwError As Long, ByRef szFunc As String) as string
Dim dwRet As Long
Dim dwTemp As Long
Dim szString As String * 2048
dwRet = FormatMessage(FORMAT_MESSAGE_FROM_HMODULE, _
GetModuleHandle("wininet.dll"), dwError, 0, _
szString, 256, 0)
ErrorOut = szFunc & " 错误代码:" & dwError & "错误信息: " & szString
If (dwError = 12003) Then
' Extended error information was returned
dwRet = InternetGetLastResponseInfo(dwTemp, szString, 2048)
ErrorOut = szString
End If
End function'在其他的过程中比方说下载文件中:
sub ...
....
....
msgbox ErrorOut( Err.LastDllError, "下载错误")
....
end sub
Dim dwRet As Long
Dim dwTemp As Long
Dim szString As String * 2048
dwRet = FormatMessage(FORMAT_MESSAGE_FROM_HMODULE, _
GetModuleHandle("wininet.dll"), dwError, 0, _
szString, 256, 0)
ErrorOut = szFunc & " 错误代码:" & dwError & "错误信息: " & szString
If (dwError = 12003) Then
' Extended error information was returned
dwRet = InternetGetLastResponseInfo(dwTemp, szString, 2048)
ErrorOut = szString
End If
End function'在其他的过程中比方说下载文件中:
sub ...
....
....
msgbox ErrorOut( Err.LastDllError, "下载错误")
....
end sub
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货