Click here to Skip to main content
11,414,619 members (68,777 online)
Click here to Skip to main content

Skype in Visual Studio (Visual Studio Extensibility C#)

, 3 Jul 2008 CPOL
Rate this:
Please Sign up or sign in to vote.
Skype in Visual Studio (Visual Studio Extensibility C#)
  • Download Installer from here

Introduction

I am a .NET developer. I always chat with my partner. I think it is a waste of time to switch windows to Skype chat dialog. I created Skype integrated with Visual Studio 2005 and 2008, that allows you to chat in your Studio. It might help you save time when you need to chat and code at the same time.

This tool will help you save your time, not needing to switch in order to chat. You can wait for someone to reply on Skype chat and code at the same time. This package allows you to select your code in Visual Studio and send it to your co-worker, you can select error stack trace and send it to someone to help you. If you want more features, please let me know.

Features

  • Chat with anyone in your contact list in Visual Studio
  • Select part of code in Visual Studio and send
  • Show received message in Visual Studio

Background

First, you need to know about Visual Studio Extensibility and Skype API. Visual Studio allows you to add any component on it, your component should be able to connect to the Studio. You also get any information in Visual Studio that contains your component.

With the Skype API, you can do chatting and make conference calls. Skype API is a COM component, Skype that provides for Windows Form. The API allows other applications able to send/receive message, make conference and there are many events that notify Skype's behavior. You can track anything that Skype does by using the API.

Using the Code

Pre-requisites

  1. Visual Studio SDK
  2. Skype client(Version 3.5 or later)
  3. Skype API, download from https://developer.skype.com

Create Visual Studio Packages for Skype

After you install Visual Studio SDK, there are many project templates, one of them is Visual Studio Integration Package located under Other Project Types > Extensibility on the New Project dialog box. Let's create a Skype project, Visual Studio Integration Package Wizard will show up.

  1. Select language, I prefer C# and say Generate a new key for this package.
  2. Put package information, company name, package name, version, minimum Visual Studio version and detail.
  3. Select package option, choose Tool Window
  4. Tool Windows information, Windows name is name of your window that will show in menu of Visual Studio and change "cmdidMyTool" to "cmdidSkypeTool"

You will get a solution that Visual Studio generates for you. Press F5 for first checking, another Visual Studio instance will show up, this is Visual Studio for development environment, load difference registry with normal Studio, that Studio instance for testing our package. If everything is ok, you will see a new menu item on View>Other window>Skype.

Now, we are ready to work on connecting to Skype via Skype API.

1. Modify Skype>MyControl.cs

2. Load Contract List

#region Constructor
public SkypeStudioControl()
{
    InitializeComponent();
    skype = new SkypeClass();
 
    //Checking for if Skype client not running, force Skype Client to start
    //Need Skype client running, if not running the Skype API will not work.
    if (!skype.Client.IsRunning)
    {
        skype.Client.Start(true, true);
        System.Threading.Thread.Sleep(300);
    }
 
    //Load contract on contract list
    this.skype.Attach(8, false);
 
    //Waiting for message from someone
    this.skype.MessageStatus += this.SkypeMessageStatusChanged;
}
#endregion

3. Send text to selected user in contact list

private void btnSend_Click(object sender, EventArgs e)
{
    if (axSkypeContactList1.Selection != null && axSkypeContactList1.Selection.Count > 0)
    {
        foreach (User var in axSkypeContactList1.Selection)
        {
            skype.SendMessage(var.Handle, this.txtSendText.Text);
        }
    }
    this.txtSendText.Text = string.Empty;
}

4. Message incoming

void SkypeMessageStatusChanged(ChatMessage message, TChatMessageStatus status)
{
    if (status == TChatMessageStatus.cmsReceived)
    {
        this.TextBox1.Text = string.Format("{0} : {1}", 
                             string.IsNullOrEmpty(message.Sender.FullName) ? 
				message.Sender.Handle 
                             : message.Sender.FullName, message.Body);
        Debug.WriteLine(string.Format("Add ChatMessage {0}, 
                             TChatMessageStatus {1}", 
                             message.Body, status.ToString()));
    }
}

Points of Interest

  • That will save you time when you need to chat.
  • Visual Studio Extensibility
  • Skype API

History

This is the first version. If you want me to improve this program, please let me know.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Keng_Mycos
Web Developer
Thailand Thailand
Keng is a .NET developer working at Mycos Technologies, a software development company based in Chiang Mai, Thailand. He has been working there since 3 years and in the duration of this period has worked on several .NET projects. He is currently working on developing an application based on Amazon Flexible Payments' architecture.

Comments and Discussions

 
QuestionLogin and Password Pin
QPal-off18-Jul-11 19:59
memberQPal-off18-Jul-11 19:59 
Questionwindow not showing in VS2008 Pin
TheEmperor20-Jan-09 23:15
memberTheEmperor20-Jan-09 23:15 
QuestionControl Skype Pin
KhangBKIT8-Oct-08 11:36
memberKhangBKIT8-Oct-08 11:36 
GeneralFix missing installer files Pin
Keng_Mycos17-Jun-08 22:50
memberKeng_Mycos17-Jun-08 22:50 
GeneralCool one! Pin
Rudra Lahiri31-Mar-08 15:22
memberRudra Lahiri31-Mar-08 15:22 
GeneralGood concept !! Pin
Niiiissssshhhhhuuuuu31-Mar-08 11:54
memberNiiiissssshhhhhuuuuu31-Mar-08 11:54 
GeneralWill put more detail in this weekend Pin
Keng_Mycos25-Mar-08 8:23
memberKeng_Mycos25-Mar-08 8:23 
GeneralBig mistake: worng download link [modified] Pin
Keng_Mycos24-Mar-08 17:01
memberKeng_Mycos24-Mar-08 17:01 
GeneralSuggestion Pin
Justin Perez24-Mar-08 14:55
memberJustin Perez24-Mar-08 14:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150427.4 | Last Updated 3 Jul 2008
Article Copyright 2008 by Keng_Mycos
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid