C# Skype bot (Skype4com) Windows Service

I've been working on a Skype bot program.

The idea is the when the user sends messages to the bot with certain keywords it will provide the results of a SQL script that is run in the background.

I've been able to get it to work as a Windows console app , but I'm trying to convert it into a Windows service.

I've tried using Top Shelf and the Visual Studio Windows service template, both are not working. I'm able to install the Windows service, but when I try to run it it fails.

I keep getting this error

Service cannot be started. System.Runtime.InteropServices.COMException (0x80040200): Not attached. at SKYPE4COMLib.ISkype.Attach(Int32 Protocol, Boolean Wait)

This happens as soon as the program tries to attach its self to Skype.

skype.Attach(7, true); I've come to the conclusion that the Windows service and Skype are on different levels and cant see each other.

I was was wondering is there any way to change this or is it impossible?

by OrdoGON via /r/csharp

Leave a Reply