Tag Archives: COM

C# to Skype

Let's talk to Skype using C#, after all Skype is used for talking, isn't it?

In order to do this, we'll need a few things. The first thing being the
Skype4COM.dll file, we'll need to add a reference to this file to be able to
use the Skype developer commands in our program.

You can get the dll file here. Just extract this file anywhere, for example your Skype installation in Program Files x86.
After you've done this, we are just one step away from using our dll file in Skype.
Open op  cmd and type this.

Now we are  all ready to use this file in C# (or any other .NET language).

Open up visual studio, make a new project and add a reference to this.

 

In the COM  tab search for Skype4COM.dll.

 

1. Coding with Skype

1.1 Loading Skype in our program.

Now we are  ready to write C# code to target our Skype application.

Open Visual Studio and choose for a Windows Forms Application. Now add a button
to this form and double click it to open the code editor.

First off we have to add System.Skype4COMLib.dll at the top of our project.

Now within the partial class skype, we have to say we want to use skype in our coding so
we need to write. Skype oSkype = new Skype();

By doing this, Skype is now in our project and intellisense will show this.

So now we can finally start coding for Skype.

1.2 Change Skype status.

to change the userstatus, we have to type the following.

oSkype.ChangeUserStatus(TUserStatus.cusOnline);

Once you run this program, Skype will throw a warning that a program is trying
to connect to it. Obviously you have to allow this for your program to work.

1.3 Sending a message

To send a message to skype, you will need to input 2 strings, the first one being the
username, the second one being your actual message. Let's make a variable for
this message and then pass it trough to one of my contacts.

 

This time Skype won't have popped up to ask if we are allowed to pass things trough
Skype. It will still remember that we allowed this last time.

1.4 Change your mood

Your mood on Skype is the little message below your Skypename, most people call it their
status but in the coding Status is already used for the actual skype Status (Online,
Offline, Away, Busy,...).

Changing your mood is similar to passing through a message on skype, but this
time we only have to insert one string.

 

1.5 How I made this.

Now there is not a lot of useful information I could find about this using the web, but
when you download the Skype4COM.dll, there is this file with it.

 

This contains all the documentation about Skype4COM and when reading trough this I
found all what I needed.

Pretty much all you need is in here.