rt

解决方案 »

  1.   

    WebBrowser控件是基于com接口实现的, 通过判断返回值 >= 0不能判断它访问成功吗?
      

  2.   

    如果你是直接用的Microsoft Web Browser的话,恐怕有点困难,首先很难知道网页什么时候加载结束了。如果使用CDHtmlDialog或者CHtmlView的话,可以收到OnDocumentComplete消息,然后在这个消息里面判断文档内容是否正确就可以知道网页是否打开成功了。
      

  3.   

    The following tables list the possible errors returned by the StatusCode parameter of the NavigateError event handler. For more information on HTTP status codes, see HTTP Status Codes.HTTP Status CodesStatus code string C++ value Visual Basic value Description 
    HTTP_STATUS_BAD_REQUEST 400 400 Invalid syntax. 
    HTTP_STATUS_DENIED 401 401 Access denied. 
    HTTP_STATUS_PAYMENT_REQ 402 402 Payment required. 
    HTTP_STATUS_FORBIDDEN 403 403 Request forbidden. 
    HTTP_STATUS_NOT_FOUND 404 404 Object not found. 
    HTTP_STATUS_BAD_METHOD 405 405 Method is not allowed. 
    HTTP_STATUS_NONE_ACCEPTABLE 406 406 No response acceptable to client found. 
    HTTP_STATUS_PROXY_AUTH_REQ 407 407 Proxy authentication required. 
    HTTP_STATUS_REQUEST_TIMEOUT 408 408 Server timed out waiting for request. 
    HTTP_STATUS_CONFLICT 409 409 User should resubmit with more info. 
    HTTP_STATUS_GONE 410 410 Resource is no longer available. 
    HTTP_STATUS_LENGTH_REQUIRED 411 411 Server refused to accept request without a length. 
    HTTP_STATUS_PRECOND_FAILED 412 412 Precondition given in request failed. 
    HTTP_STATUS_REQUEST_TOO_LARGE 413 413 Request entity was too large. 
    HTTP_STATUS_URI_TOO_LONG 414 414 Request Uniform Resource Identifier (URI) too long. 
    HTTP_STATUS_UNSUPPORTED_MEDIA 415 415 Unsupported media type. 
    HTTP_STATUS_RETRY_WITH 449 449 Retry after doing the appropriate action. 
    HTTP_STATUS_SERVER_ERROR 500 500 Internal server error. 
    HTTP_STATUS_NOT_SUPPORTED 501 501 Server does not support the functionality required to fulfill the request. 
    HTTP_STATUS_BAD_GATEWAY 502 502 Error response received from gateway. 
    HTTP_STATUS_SERVICE_UNAVAIL 503 503 Temporarily overloaded. 
    HTTP_STATUS_GATEWAY_TIMEOUT 504 504 Timed out waiting for gateway. 
    HTTP_STATUS_VERSION_NOT_SUP 505 505 HTTP version not supported. HRESULT Status CodesStatus code string C++ value Visual Basic value Description 
    INET_E_INVALID_URL (0x800C0002L) -2,146,697,214 URL string is not valid. 
    INET_E_NO_SESSION (0x800C0003L) -2,146,697,213 No session found. 
    INET_E_CANNOT_CONNECT (0x800C0004L) -2,146,697,212 Unable to connect to server. 
    INET_E_RESOURCE_NOT_FOUND (0x800C0005L) -2,146,697,211 Requested resource is not found. 
    INET_E_OBJECT_NOT_FOUND (0x800C0006L) -2,146,697,210 Requested object is not found. 
    INET_E_DATA_NOT_AVAILABLE (0x800C0007L) -2,146,697,209 Requested data is not available. 
    INET_E_DOWNLOAD_FAILURE (0x800C0008L) -2,146,697,208 Failure occurred during download. 
    INET_E_AUTHENTICATION_REQUIRED (0x800C0009L) -2,146,697,207 Requested navigation requires authentication. 
    INET_E_NO_VALID_MEDIA (0x800C000AL) -2,146,697,206 Required media not available or valid. 
    INET_E_CONNECTION_TIMEOUT (0x800C000BL) -2,146,697,205 Connection timed out. 
    INET_E_INVALID_REQUEST (0x800C000CL) -2,146,697,204 Request is invalid. 
    INET_E_UNKNOWN_PROTOCOL (0x800C000DL) -2,146,697,203 Protocol is not recognized. 
    INET_E_SECURITY_PROBLEM (0x800C000EL) -2,146,697,202 Navigation request has encountered a security issue. 
    INET_E_CANNOT_LOAD_DATA (0x800C000FL) -2,146,697,201 Unable to load data from the server. 
    INET_E_CANNOT_INSTANTIATE_OBJECT (0x800C0010L) -2,146,697,200 Unable to create an instance of the object. 
    INET_E_REDIRECT_FAILED (0x800C0014L) -2,146,697,196 Attempt to redirect the navigation failed. 
    INET_E_REDIRECT_TO_DIR (0x800C0015L) -2,146,697,195 Navigation redirected to a directory. 
    INET_E_CANNOT_LOCK_REQUEST (0x800C0016L) -2,146,697,194 Unable to lock request with the server. 
    INET_E_USE_EXTEND_BINDING (0x800C0017L) -2,146,697,193 Reissue request with extended binding. 
    INET_E_TERMINATED_BIND (0x800C0018L) -2,146,697,192 Binding is terminated. 
    INET_E_CODE_DOWNLOAD_DECLINED (0x800C0100L) -2,146,697,960 Permission to download is declined. 
    INET_E_RESULT_DISPATCHED (0x800C0200L) -2,146,696,704 Result is dispatched. 
    INET_E_CANNOT_REPLACE_SFP_FILE  (0x800C0300L) -2,146,696,448 Cannot replace a protected System File Protection (SFP) file. 
      

  4.   

    Private Sub object_NavigateError( _
    ByVal pDisp As Object, _
    ByVal URL As Variant, _
    ByVal TargetFrameName As Variant, _
    ByVal StatusCode As Variant, _
    ByRef Cancel As Boolean)
    Parametersobject
    Object expression that resolves to the objects in the Applies To list. 
    pDisp
    Object that evaluates to the top-level or frame WebBrowser object corresponding to the failed navigation.
    URL
    String expression that evaluates to the URL for which navigation failed.
    TargetFrameName
    String that evaluates to the name of the frame in which the resource is to be displayed, or Null if no named frame is targeted for the resource. 
    StatusCode
    Integer that contains a status code corresponding to the error, if available. For a list of the possible status codes, see NavigateError Event Status Codes.
    Cancel
    Boolean that specifies whether to cancel the navigation to an error page and/or any further autosearch.False
    Default. Continue with navigation to an error page and/or autosearch.
    True
    Cancel navigation to an error page and/or autosearch.