narasimhak_
Tue Mar 7 2006, 01:33
Hi,
I am a beginner to learn about API's. I am just confused about how to use skype api using C# programming langauge. Do i need to register any dll's. Can anyone help me regarding this issue. I would appretiate if any body has a small example and documentation of how to access SKYPE API.
Thanks
Narasimha
prakashvit_
Thu Mar 9 2006, 12:29
Dear Narasimha,
My suggestion is use ActiveS library, it will comewith ActiveS.dll COM component. You can download from this site
http://www.khaoslabs.com/actives.php
More number of samples are available in the internet. I paste here some line of source code using C#.
// Skype API reference
private SKYPEAPILib.Access m_oSkype ;
// Creating Skype Object
m_oSkype = new SKYPEAPILib.AccessClass();
// Bind the call status change event
m_oSkype.CallStatusChanged += new SKYPEAPILib._IAccessEvents_CallStatusChangedEventHandler(this.OnCallStatusChanged);
//Connect into the application
m_oSkype.Connect();
....
write the call status change method for handling the incoming/outcoming calls.
narasimhak_
Thu Mar 9 2006, 22:38
HI Prakash,
Thanks for your reply. As you guided me, i downloaded Activs from
http://www.khaoslabs.com/actives.php (which you have mentioned). But i could not find 'SkypeAPI 1.0 Type Library' in the Add References location of .Net environment. I am confused, why i am not able to view skype dll inorder to add into my C# project. Can you please help me.
regards,
Narasimha
prakashvit_
Fri Mar 10 2006, 08:09
Dear Narshima,
I mentioned earlier, ActiveS is a COM Wrapper dll. Go to Add Reference and select the tab COM and select the "ActiveS 1.0 Type Library" and start using in your code. Dont forget to import the Skype Api
using SKYPEAPILib;
narasimhak_
Tue Mar 14 2006, 23:37
Hi Prakash,
Thanks for guiding me. I shifted my programming language to VB.Net from C#. I felt vb.net is easy than C#. As you told, i installed actives and added the reference 'actves 1.0' into my vb.Net project. But i am not sure how to i check for the skype access permission skype. I mean when i connect my client app, skype pops up with some window asking user whether it want to allow the client to access skype.
1. Allow this program to use skype
2. allow this program ti use skype, but ask again in the future
3. Do not allow this program to use skype
My question is, how do i check in my program which option is selected and move according to that. I mean, if permission is not granted, i want to display an error message and if permission is granted, then proceed further. When i click on the connect button of my application, my app will connect to the skype api and then it should proceed further based on the skype access permission.
My code is as below:
Private Sub cmdConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdConnect.Click
objSkype.Connect()
If objSkype.APIAttachmentStatus.apiAttachUnknown = -1 Then
MsgBox("Unknown", MsgBoxStyle.Information, "Msg Box")
ElseIf objSkype.APIAttachmentStatus.apiAttachSuccess = 0 Then
MsgBox("Success", MsgBoxStyle.Information, "Msg Box")
'cmdDisconnect.Enabled = True
'txtBuddyList.Enabled = True
'txtBuddyList.AppendText("Success")
ElseIf objSkype.APIAttachmentStatus.apiAttachPendingAuth = 1 Then
MsgBox("Pending", MsgBoxStyle.Information, "Msg Box")
'txtBuddyList.AppendText("Pending")
ElseIf objSkype.APIAttachmentStatus.apiAttachRefused = 2 Then
MsgBox("Refused", MsgBoxStyle.Information, "Msg Box")
'txtBuddyList.AppendText("Refused")
ElseIf objSkype.APIAttachmentStatus.apiAttachNotAvailable = 3 Then
MsgBox("Not Available", MsgBoxStyle.Information, "Msg Box")
'txtBuddyList.AppendText("Not Available")
ElseIf objSkype.APIAttachmentStatus.apiAttachAPIAvail = 32769 Then
MsgBox("Available", MsgBoxStyle.Information, "Msg Box")
'txtBuddyList.AppendText("Available")
End If
End Sub
prakashvit_
Wed Mar 15 2006, 07:25
hi,
Thats not a problem, you can know what the user selects in the API attachement status using APIStatusChanged event.
The C# example i pasted here.
CODE
// Bind the event in the form load
m_oSkype.APIStatusChanged += new SKYPEAPILib._IAccessEvents_APIStatusChangedEventHandler(this.OnAPIStatusChanged);
//Event
private void OnAPIStatusChanged(SkypeAPIAttachmentStatus z_status)
{
switch (z_status)
{
// Check if pending authorization. If pending then, hide the current window
case SKYPEAPILib.SkypeAPIAttachmentStatus.apiAttachPendingAuth:
SetStatus ("Authorization Pending");
//this.Hide ();
HideSystemTray ();
break;
// If the attacment status sucess, then hide into the system tray
case SKYPEAPILib.SkypeAPIAttachmentStatus.apiAttachSuccess:
break;
// Check if user refuse the API attach window. If refused, then close the application and skype
case SKYPEAPILib.SkypeAPIAttachmentStatus.apiAttachRefused:
break;
}
}
narasimhak_
Thu Mar 16 2006, 01:08
Hi prakash,
Thanks for guiding me. I wrote a code for objSkype_APIStatusChanged(ByVal Status As SKYPEAPILib.SkypeAPIAttachmentStatus) Handles objSkype.APIStatusChanged in VB.Net. I have another problem, that when i run my client application, now i am not able to see the Skype access window. The value of the Status is always 'apiAttachRefused'. I am not sure why 'status' is returning refused value always. I am not sure where am i doing wrong. I ran vb.net example from www.khaoslabs.com. It is also returning refused value. The code which i have return is as below:
Private Sub cmdConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdConnect.Click
objSkype.Connect()
On Error GoTo test
Exit Sub
test:
MsgBox(Err.Description, MsgBoxStyle.Critical, "Error Message")
Me.Close()
Exit Sub
End Sub
Private Sub objSkype_APIStatusChanged(ByVal Status As SKYPEAPILib.SkypeAPIAttachmentStatus) Handles objSkype.APIStatusChanged
If Status = SKYPEAPILib.SkypeAPIAttachmentStatus.apiAttachUnknown Then
MsgBox("Unknown", MsgBoxStyle.Information, "Msg Box")
ElseIf Status = SKYPEAPILib.SkypeAPIAttachmentStatus.apiAttachSuccess Then
MsgBox("Success", MsgBoxStyle.Information, "Msg Box")
'cmdDisconnect.Enabled = True
'txtBuddyList.Enabled = True
'txtBuddyList.AppendText("Success")
ElseIf Status = SKYPEAPILib.SkypeAPIAttachmentStatus.apiAttachPendingAuth Then
MsgBox("Pending", MsgBoxStyle.Information, "Msg Box")
ElseIf Status = SKYPEAPILib.SkypeAPIAttachmentStatus.apiAttachRefused Then
MsgBox("Refused", MsgBoxStyle.Information, "Msg Box")
ElseIf Status = SKYPEAPILib.SkypeAPIAttachmentStatus.apiAttachNotAvailable Then
MsgBox("Not Available", MsgBoxStyle.Information, "Msg Box")
ElseIf Status = SKYPEAPILib.SkypeAPIAttachmentStatus.apiAttachAPIAvail Then
MsgBox("Available", MsgBoxStyle.Information, "Msg Box")
End If
End Sub
regards,
Narasimha
prakashvit_
Thu Mar 16 2006, 07:34
Open your skype and log into the skype ....
Go to Tools->Options, select Privacy and click the link "Manage other Programs access to skype"
in that window, select the exe name and delete the exe's.
Now retry with your program. Once u select the option in the API attachment status as refused, then it never asks the attachement status window. you can change the option else delete the option in the privacy settings.
priyanka2k3_
Sat Aug 5 2006, 10:25
Hi Prakashvit!!
i'm building an applicaion using asp.net through which i want to place a call through skype. i've downloaded & added skypeApiLib to my project.
the code i'm using to connect to skype is :
objSkype = New SKYPEAPILib.AccessClass
objSkype.Connect()
but still i'm not granted access to skype. Can you please help!!
Do reply asap!!
Paul Cotton
Mon Sep 11 2006, 10:33
QUOTE(prakashvit @ Thu Mar 16 2006, 07:34) [snapback]230787[/snapback]
Open your skype and log into the skype ....
Go to Tools->Options, select Privacy and click the link "Manage other Programs access to skype"
in that window, select the exe name and delete the exe's.
Now retry with your program. Once u select the option in the API attachment status as refused, then it never asks the attachement status window. you can change the option else delete the option in the privacy settings.
I've had a similar problem with 'Attachment Status Window' with a VB6 application using the ActiveS wrapper. I've tried deleting the application from the "Manage other Programs access to skype" window. I have been testing the application on four different PCs, two work fine (showing up the 'Attachment Status Window' every time I modify the application) and two just refuse access without popping up the 'attachment status window'. All PCs use Windows XP but have different processors. As far as I know, they are all set up identically. Does anyone know of any way to force the 'attachment status window' to get displayed ?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.