Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Looking for Visual Basic code that will allow me to send and receive instant messages over Skype?

I have VB 2005 Express Edition, and I am looking for Visual Basic code that will allow me to:

1. Monitor incoming messages from a specific contact in Skype

2. Retrieve those messages.

3. Be able to send messages.

1 Answer

Relevance
  • m b
    Lv 5
    4 years ago

    you will need to add a refrence to SKYPE4COMLib

    if you want the full project just comment on here and il send it or ftp over or somthing (i never used SKYPE4COMLib before 10 mins ago and havent used vb for over 10 years so little rusty)

    just to warn you skype will ask the users permission to access this via this method as in if its running in back ground when the user logs in will say request access by xxxx.exe to access skypeapi

    then code is

    Imports SKYPE4COMLib

    Imports Enumerable = System.Linq.Enumerable

    Public Class Form1

    Dim SkypeApi As SKYPE4COMLib.Skype

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

    SkypeApi = New SKYPE4COMLib.Skype()

    Dim personName As String = "Friendly name"

    Dim chats As List(Of String) = New List(Of String)()

    ' all chat messages from that contact in linq

    chats = Enumerable.ToList(Of String)((From chat As Chat In SkypeApi.Chats Where chat.FriendlyName = personName From message As ChatMessage In chat.Messages Select message.Body))

    ' all chat messages from that contact readable bit more readable

    For Each chat As SKYPE4COMLib.Chat In SkypeApi.Chats

    If chat.FriendlyName = personName Then

    Dim messageCollection = chat.Messages

    For Each message As SKYPE4COMLib.ChatMessage In messageCollection

    chats.Add(message.Body)

    Next

    End If

    Next

    'send message

    SkypeApi.SendMessage("username", "messageToSend")

    End Sub

    End Class

Still have questions? Get your answers by asking now.