2

I am making my first Skype app that can simply message a user but when I debug I get a exception that crashes my app. Here is the code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using skype_app;
using SKYPE4COMLib;

namespace skype_app
{
    public partial class Form1 : Form
    {

        public Form1()
        {
            InitializeComponent();

        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }



        private void button2_Click(object sender, EventArgs e)
        {
            var oskype = new SKYPE4COMLib.Skype();
            oskype.PlaceCall(textBox1.Text);
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
           var oskype = new SKYPE4COMLib.Skype();
           oskype.SendMessage(textBox1.Text, textBox2.Text);
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }
    }
}

i have use some extra references references list:

  • Microsoft.Csharp
  • SKYPE4COMlib
  • SkypeDialoglib
  • system
  • system.core
  • system.data
  • system.data.DataSetEXTensions
  • system.deployment
  • system drawing
  • System.Windows.forms
  • System.xml.linq

Here is the exception i get: System.RUntime.InteropServices.ComException : {"connection refused"} So I guess my main question is why does my connection get refused when Skype dose not even open the dialogue asking if I want to allow the connection ?

Patrick Geyer
  • 1,515
  • 13
  • 30
Gerard2202
  • 151
  • 6
  • 18

2 Answers2

10

The issue is that you're trying to debug in Visual Studio. Unfortunately, according to Skype themselves, they do not support using this API & debugging in VS:

Per the link:

The most comment cause for this is you are trying to debug the program in Visual Studio. Going forward we will not be able to support using the visual studio hosting process for debugging. You can turn it off by:

  • Open your project in VS
  • Open your projects properies
  • click the debug tab
  • untick "use visual studio hosting process"
  • rebuild your application and begin debugging and it should work ok.
qJake
  • 16,821
  • 17
  • 83
  • 135
Chris
  • 2,885
  • 18
  • 25
  • Debugging in Visual Studio and Debugging using the [Visual Studio Hosting Process](http://msdn.microsoft.com/en-us/library/ms185331.aspx) are two very different things. – Scott Chamberlain Jul 10 '13 at 21:33
  • its ok i just built the solution the application was not supported in debug mode – Gerard2202 Jul 10 '13 at 22:15
2

i face the same issue. this way i solved it.

here is my code

Skype skype;
skype = new SKYPE4COMLib.Skype();
Call call = skype.PlaceCall(txtPhonenNo.Text);

first thing login to skype and go to Tools > option > advanced settings

your screen would look like enter image description here

click on manage other program's access to skype

then another window will come which will show all program name which try to access skype. if any exist just select all and remove it.

then run your program again and go to that screen where this option was available called click on manage other program's access to skype

click there and a windows will come which will display the name of your apps just select that name and click on change button then another window will come which looks like enter image description here

in that window just select the option called allow this program to access skype then a dialog come on the skype window which looks like enter image description here where you need to click on allow access button and then your job will be done. hope this will help.

Thomas
  • 33,544
  • 126
  • 357
  • 626