vb.netskype4com

How to send an image through the Skype API?


I am using the Skype4ComLib library to try and send an image to a contact on Skype.

Private Sub Button17_Click(sender As Object, e As EventArgs) Handles btnImageLoad.Click
    OpenFileDialog1.ShowDialog()
    PicBox.ImageLocation = OpenFileDialog1.FileName.ToString
End Sub

This opens a dialog box for the user to select an image and loads it into a picture box called PicBox.

Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click
    TimerImage.Stop()
End Sub

Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button16.Click
    TimerImage.Stop()
End Sub

Buttons 15 and 16 start the timer.

I want to send the image from within the timer but I can't use skype.sendmessage as it only accepts a string.

Any ideas?


Solution

  • Using the SendKeys.Send method you can paste the picture from the clipboard in the message via the actual Skype application.

    This is how I do it:

    My.Computer.Clipboard.SetImage(PicBox.Image)
    SkypeClient.Client.OpenMessageDialog("<contact to send to>")
    SkypeClient.Client.Focus()
    SendKeys.Send("^(V){ENTER}")
    

    Replace <contact to send to> with the name of the contact you want to send the picture to.