
02/10/2017, 16:57
|
 | | | Fecha de Ingreso: febrero-2007 Ubicación: México
Mensajes: 823
Antigüedad: 18 años, 1 mes Puntos: 24 | |
Aporte: ¿Cómo detectar que programa está asociado al protocolo mailto? Les comparto este código para saber con que programa se va a abrir el comando mailto cuando por ejemplo hagamos clic en un enlace de correo en el navegador:
Public Function getMailtoApp() As String
Dim ret As Long, key As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.ClassesRoot
Dim rtn As String = "", secondKey As String = ""
key = key.OpenSubKey("mailto\Shell\Open\Command")
If key IsNot Nothing Then
secondKey = key.GetValue("").ToString().Trim
If secondKey.IsNullOrEmpty(secondKey) = False Then
rtn = secondKey.Trim
rtn = System.Text.RegularExpressions.Regex.Match(rtn, "\""(.*?)\""").Groups(0).Value
End If
End If
rtn = rtn.Trim
If rtn.StartsWith(Chr(34)) = True Then rtn = rtn.Substring(1, rtn.Length - 1)
If rtn.EndsWith(Chr(34)) = True Then rtn = rtn.Substring(0, rtn.Length - 1)
Return rtn
End Function
Última edición por Malenko; 06/10/2017 a las 01:14 |