Ver Mensaje Individual
  #2 (permalink)  
Antiguo 19/10/2010, 07:40
xMarioHx
 
Fecha de Ingreso: septiembre-2009
Mensajes: 33
Antigüedad: 14 años, 7 meses
Puntos: 1
Respuesta: VB Herremienta de Diagnostico de Red

Lo solucione, dejo el código, quizás a alguien le sirva.

Es un SUB, puedes llamarlo donde quieras, y enviara un mensaje si tiene una conexión valida, en caso contrario ejecutara el Diagnostico de Windows.

checkRed()

Código vb:
Ver original
  1. Public Sub checkRed() ' Comprobamos si tiene acceso a la red
  2.        Dim vinculo As New System.Uri("http://www.aimbox.cl/")
  3.         Dim objWebReq As System.Net.WebRequest
  4.         objWebReq = System.Net.WebRequest.Create(vinculo)
  5.         Dim objResp As System.Net.WebResponse
  6.         Try
  7.             objResp = objWebReq.GetResponse
  8.             objResp.Close()
  9.             objWebReq = Nothing
  10.             ' Tienes conexión a Internet
  11.            MsgBox("Su Conexión a Internet es Valida")
  12.         Catch ex As Exception
  13.             objWebReq = Nothing
  14.             If MsgBox("Su sistema no cuenta con una conexión a Internet valida." & (Chr(13)) & (Chr(13)) & "¿Desea Abrir el Asistente de Conexión de Internet?", MsgBoxStyle.Question, "Error de Red") = MsgBoxResult.Ok Then
  15.                 ' LLamamos a la herramienta de diagnostico de redes
  16.                Try
  17.                     ' Windows Xp
  18.                    System.Diagnostics.Process.Start("C:/WINDOWS/network diagnostic/xpnetdiag.exe")
  19.                 Catch ex As Exception
  20.                     Try
  21.                         ' Windows XP
  22.                        System.Diagnostics.Process.Start("%systemroot%/network diagnostic/xpnetdiag.exe")
  23.                     Catch ex2 As Exception
  24.                         Try
  25.                             ' Windows Seven
  26.                            System.Diagnostics.Process.Start("C:/WINDOWS/diagnostics/system/Networking/DiagPackage.diagpkg")
  27.                         Catch ex3 As Exception
  28.                             MsgBox("Lo Siento, No he podido iniciar el diagnostico de Windows de forma automática. Por favor realícelo manualmente y vuelva a ejecutar el programa.", MsgBoxStyle.Information, "Diagnostico no Ejecutado")
  29.                             Try
  30.                                 Shell("RunDll32.exe shell32.dll,Control_RunDLL ncpa.cpl")
  31.                                 End
  32.                             Catch ex4 As Exception
  33.                                 End
  34.                             End Try
  35.                         End Try
  36.                     End Try
  37.                 End Try
  38.             End If
  39.         End Try
  40.     End Sub

PD: No encontré la ruta de Windows vista, pero debería ser igual a la de Seven


Última edición por xMarioHx; 19/10/2010 a las 09:29