在 Visual Basic 2010 中打开 Skype

在 Visual Basic 2010 中打开 Skype

如何在 Visual Basic 2010 中打开 Skype。

如果安装了 Skype,请打开它,如果没有,请下载它。

 Private Sub skype_Click(sender As System.Object, e As System.EventArgs) Handles skype.Click
    Dim rk As RegistryKey = Registry.ClassesRoot.OpenSubKey("skype\shell\open\command", False) '"skype\shell\open\command"
    Dim ReturnedValue As String = ""
    Try
        ReturnedValue = CStr(rk.GetValue(""))
        Dim ReturnedValueSplit() As String = ReturnedValue.Split(CChar(ChrW(34)))
        ReturnedValue = ReturnedValueSplit(1)
        ReturnedValue = ReturnedValue.Replace(CChar(ChrW(34)), "")
        If My.Computer.FileSystem.FileExists(ReturnedValue) = True Then
            System.Diagnostics.Process.Start(ReturnedValue)("C:\Program Files (x86)\Skype\Phone\Skype.exe")
        Else
            System.Diagnostics.Process.Start("http://www.skype.com/en/download-skype/skype-for-windows/downloading")
        End If

    End Try
End Sub

答案1

这个答案可能会有帮助

Option Strict On

Imports Microsoft.Win32

Public Class Form1

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Me.CenterToScreen()
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Dim rk As RegistryKey = Registry.ClassesRoot.OpenSubKey("skype\shell\open\command",    
False) '"skype\shell\open\command"
    Dim ReturnedValue As String = ""
    Try
        ReturnedValue = CStr(rk.GetValue(""))
        Dim ReturnedValueSplit() As String = ReturnedValue.Split(CChar(ChrW(34)))
        ReturnedValue = ReturnedValueSplit(1)
        ReturnedValue = ReturnedValue.Replace(CChar(ChrW(34)), "")
        If My.Computer.FileSystem.FileExists(ReturnedValue) = False Then
            Process.Start("http://www.skype.com/en/download-skype/skype-for-
windows/downloading/")
        Else
            Process.Start(ReturnedValue)
        End If
    Catch ex As Exception

    End Try
End Sub

End Class

相关内容