Help - Search - Members - Calendar
Full Version: Sample code
Skype Community > English > Development, Betas and Skype Garage > Skype Public API
Pages: 1, 2
taavet_
Some examples to get you started using the Skype API:Tools, API wrappers and tutorials are available from third parties. These can be found in the Development section of the Skype Extras Gallery. Please note that unless clearly marked as ‘Skype Certified’ these tools should be used at your own risk.

For information on how to integrate your applications with Skype via Publishing Studio / Extras Manager and on basics of the DRM system, check out Skype Extras Examples by Charles Palmer.

See also the API documentation.

//changed by ppmotskula on 2006-03-31
//change by mirksa on 2007-05-31
//change by mirksa on 2007-06-20
rsaccon_
Great, this is exactly the entrypoint I was looking for. Now it became very easy to explore all the possibilities the api offers.

I have read the EULA regarding the API. Now I would like to know when you start to consider an application which uses the api as commercial, and in case you consider it as commercial, what are the licensing costs ? Who should I contact for those details ?

I am asking for that, because if commercial API licensing costs are beyond the limits of my small company, I consider to split the part of my project which uses the Api into a seperate project, which could be free, open source, providing added value independent from my commercial project.

regards
Roberto
rtxleh_
The sample doesnt perform UTF-8 encoding/decoding?

Leo Havmøller.
taavet_
Yes that is correct - the example posted does not contain UTF8 encoding/decoding. But it should be very easy to find samples for dealing with UTF8.

And about licencing - we workin on the licencing scheme and will either contact you or post on the forum when we are ready to discuss this.
artyomt_
can you convert it to sticky, Taavet ?
taavet_
thanks, done
Qe_G_
YEAH you get it!!!
I hope the API will become a new Standard bigsmile.png
I am loocking for new possibilities for my applications.

Greeting from Germany!
prasannakumar_
hi all ....
i am new to this group .... i want to create an application which works similar to that of answering machine by integrating with VOIP service... can anyone help me in writing the code to develop the appliATION ...how to use skype API's to design my application ............

help me in doing this ... i have to submit this as a project in my engineering college

hope i wilget reply soooon


thanks

prasannakumar
leecher_
Hi!

As I'm currently coding a plugin, which uses the Skype API and which is used by many people, I noticed the following problem with the demo-code:

You do a:
CODE


SendMessage( HWND_BROADCAST, uiGlobal_MsgID_SkypeControlAPIDiscover, (WPARAM)hInit_MainWindowHandle, 0)


to broadcast to all Windows. That's fine, but it recently happened to a user of my program, that he had a window on his system, which wasn't responding correctly (messagepump didn't work) and therefore my whole application hung.
To prevent a deadlock, I would suggest using:
CODE


SendMessageTimeout(HWND_BROADCAST, uiGlobal_MsgID_SkypeControlAPIDiscover, (WPARAM)hInit_MainWindowHandle, 0, SMTO_ABORTIFHUNG, 1000, NULL);


What do you think?
amichai_
taavet hi,

I am trying your sample code, but can't complie it - it doesn't recognize "_beginthread".

Am I missing something?


Thanks.
leecher_
Forgot to #include <process.h> ?
arnon_
You should add "/MT" compilation flag and "Rpcrt4.lib" library.

Good luck.
flurwoche_
Hi there,

is any sample code for osx avaliable?

thanks,
Mace
tzjoaqe_
QUOTE(arnon)
You should add \"/MT\" compilation flag and \"Rpcrt4.lib\" library.

Good luck.


where is Rpct4.lib??
tzjoaqe_
QUOTE(taavet)
Hi all and thanks for the comments and bugreports. We will be fixing the bugs with upcoming releases.

Meanwhile I posted sample code to get you going quicker:
http://www.skype.com/community/devzone/samplecode.zip

What the sample does is that it makes a connection to Skype over the API and lets you type the textbased commands while echoing back replies from Skype.

Happy coding,

taavet


I can't complier the sample code in VC++

Compiling...
msgapitest.cpp
C:Documents and
SettingsPennyLeeDesktopSkypemsgapitest.cpp(318)
: error C2065: '_beginthread' : undeclared
identifier
Error executing cl.exe.

Why?? and what I can do??
varjupe_
Hi !

If you have a Visual Studio C++, then run the next simple commands from command line:

CODE
cl /MT /c msgapitest.cpp

link user32.lib RPCRT4.LIB msgapitest.obj


If you work GUI then do next steps:
- open msgapitest.cpp with Visual C++
- press compile button (CTRL+F7)
- press YES at question
- Build menu / Set Active Configuration... / select Win32 Release, OK
- Project menu / Settings... / "C/C++" tab
- Category: Code Generation
- Use run-time library: Multithreaded
- Choose "Link" tab
- Insert the "RPCRT4.LIB" into Object/library modules

That's all !
I hope it will be help you !
Bye !

- Peter
tzjoaqe_
thank you
It's working now
yanga_
It's work fine bigsmile.png

Thank you !
Kevin Langlois_
HEY ! .....Check out http://www.khaoslabs.com/index.php?page=skypeapi for an easy-to-use COM wrapper for SKYPE.

Just a suggestion

-PointBlank
DrCheat_
I use the demo as an entrypoint for an application I am writing. However, when I enter the "Send Skype Command" SendMessage statement, it fails in my application whereas it works perfectly in the demo.

CODE


if (SendMessage( skype_hWnd, WM_COPYDATA, (WPARAM)this->m_hWnd, (LPARAM)&oCopyData )==FALSE )



I used Spy++ to check if my own window handle is correct, and I used the demo program to check if the skype_hWnd variable is filled correctly. Both variables are correct. But each time this statement get's executed it returns FALSE, and thus doesn't send anything to the Skype client.

Does anyone know what is going on?
billychan_
Can anyone provide me some sample code that perform UTF-8 decoding? thanks very much!!!
NoOneElse_
Yesterday I tried out the API samples for Linux and they worked just fine. In fact, I derived from it a script which takes an API command on the command line and sends it to a running Skype instance which comes very handy for shell scripting Skype (e.g. to control my Skype status with a webcam: http://firmerground.net/archives/2005-07-2...igent_aut.shtml)
asker_
Hi,May I get my chat history after closing Skype?
where is it?It is kept locally ?
Kevin Delaney
Hi there, asker! Welcome to the forums!

You can get chat histories by either right-clicking a contact and selecting "View Chat History" or by going to (default)

[b]C:Documents and SettingsWindows Username

That should bring up a folder of your latest logs, if I'm not mistaken.

Regards,

-kevin
asker_
Thank u,Kevin!I can see it as u guide.But I cann't see the chat history generated on another computer.How can i do it?
sikosis_
the link takes me to the developer blog ?
granger_
[quote=sikosis]the link takes me to the developer blog ?[/quote]

Me too! Can someone fix this please?
granger_
[quote=mscoville]http://share.skype.com/developer_zone/documentation/documentation/[/quote]

Thanks again, mscoville. You're my hero. bigsmile.png
mscoville_
thing to note about the examples is that they dont set the protocol.
HenryHan_
HI, I am also a Skype new starter, and wish to see the sample code very much. But when I click the hyperlink it will redirect me to the http://share.skype.com/share/developer_blog// and I cannot find where to download the code. Could anyone Pls mail me the code if you have to ying.henryhan@gmail.com? Thanks a lot!!!
Gordon Wilmot_
This gives you all the entries for the sample code section of the extras

http://share.skype.com/directory/sample_code/

there are C++, VB6 & C# samples here...
HenryHan_
But the problem is: where is the file Rpcrt4.lib? You have to provide a directory to VC++ when linking
ortiga_
Helo, I have some problems during compilation skypeapitest in visual c++ 2005 express edition. Code is the original from example....
CODE
Error 1 error C2664: 'UuidToStringW' : cannot convert parameter 2 from 'unsigned char **' to 'RPC_WSTR *' g:...msgapitest.cpp 181

Error 2 error C2440: '=' : cannot convert from 'char [128]' to 'LPCWSTR' g:...msgapitest.cpp 197

Error 3 error C2664: 'RpcStringFreeW' : cannot convert parameter 1 from 'unsigned char **' to 'RPC_WSTR *' g:...msgapitest.cpp 202

Error 4 error C2664: 'UnregisterClassW' : cannot convert parameter 1 from 'char [128]' to 'LPCWSTR' g:...msgapitest.cpp 212

Error 5 error C2664: 'CreateWindowExW' : cannot convert parameter 2 from 'char [128]' to 'LPCWSTR' g:...msgapitest.cpp 220

Error 6 error C2664: 'RegisterWindowMessageW' : cannot convert parameter 1 from 'const char [22]' to 'LPCWSTR' g:...msgapitest.cpp 307

Error 7 error C2664: 'RegisterWindowMessageW' : cannot convert parameter 1 from 'const char [24]' to 'LPCWSTR' g:...msgapitest.cpp 308

Error 8 error C2664: 'UuidToStringW' : cannot convert parameter 2 from 'unsigned char **' to 'RPC_WSTR *' g:...msgapitest.cpp 181

Error 9 error C2440: '=' : cannot convert from 'char [128]' to 'LPCWSTR' g:...msgapitest.cpp 197

Error 10 error C2664: 'RpcStringFreeW' : cannot convert parameter 1 from 'unsigned char **' to 'RPC_WSTR *' g:...msgapitest.cpp 202

Error 11 error C2664: 'UnregisterClassW' : cannot convert parameter 1 from 'char [128]' to 'LPCWSTR' g:...msgapitest.cpp 212

Error 12 error C2664: 'CreateWindowExW' : cannot convert parameter 2 from 'char [128]' to 'LPCWSTR' g:...msgapitest.cpp 220

Error 13 error C2664: 'RegisterWindowMessageW' : cannot convert parameter 1 from 'const char [22]' to 'LPCWSTR' g:...msgapitest.cpp 307

Error 14 error C2664: 'RegisterWindowMessageW' : cannot convert parameter 1 from 'const char [24]' to 'LPCWSTR' g:...msgapitest.cpp 308


Thx for help


UPDATE: is problem with unicode. Projects properities> General> Character Set:: Not Set
ppmotskula
For those of you who never return to the start of the old threads: I've just changed the starting post of this forum as follows:[quote]Some examples to get you started using the Skype API:

* Example C++ code for Windows
* Example Python code for Linux
* Examples for OSX

Tools, API wrappers and tutorials are available from third parties. These can be found in the Development section of the Skype Extras Gallery. Please note that unless clearly marked as ‘Skype Certified’ these tools should be used at your own risk.

See also the API documentation.[/quote]
badvox
Okay folks, I have read through all of these posts and searched as well.

Yes, I have the sample CONSOLE app and it works just fine. I even made a workspace for it
etc etc etc.

Now the issue I have is I try to do something as simple as ping in a Dialog application and it always fails.
I can connect and all that but any WM_COPYDATA functions fail.


-- EDIT --

Okay I figured out what my issue was. Do NOT call the defwindproc if it was a handled Skype message.
That will end up returning false to skype which causes bad things to happen. I guess I will post the example_win project in MFC.
Anyone care to chime in if thats a good idea or not?
thething
Can someone please show me how to request or set the skype protocol version when using the API for Windows?
I've read this page https://developer.skype.com/Docs/ApiDoc/Skype_protocol but I don't see the syntax of doing it.
When I'm using the API, I get the MESSAGE object instead of CHATMESSAGE, so I think I'm using the wrong protocol version. How do I check that?
Thanks.
ikelos
Here's some very simplistic python code for the Linux API using the x11 messaging system.

It requires python-xlib (http://python-xlib.sourceforge.net/) and it currently attempts to connect to a running skype instance, and once it's all OKed, it specifies protocol 5 and then listens for incoming messages.

It's just a basis for other programs, but should give a good idea of how to communicate successfully with skype through xlib.

Hope it's of some use,

Mike 5:)
mike_pukuotukas_lt
Hello,

I recently got interested in skype API, so what i did i downloaded example_win.zip, i also have DEV-C++ for my c++ projects, but the thing is that i cant compile this source. Errors below:
[Linker error] undefined reference to `UuidCreate@4'
[Linker error] undefined reference to `UuidToStringA@8'
[Linker error] undefined reference to `RpcStringFreeA@4'
ld returned 1 exit status
...\skype-api\Makefile.win [Build Error] [test.exe] Error 1

This example works with C++ Builder 5 fine, but i prefer Dev-C++. Any sugestions?

PS: sorry of my english, im not very good at it. smile.png
TheUberOverlord
QUOTE(mike_pukuotukas_lt @ Tue Feb 27 2007, 14:12) [snapback]365520[/snapback]

Hello,

I recently got interested in skype API, so what i did i downloaded example_win.zip, i also have DEV-C++ for my c++ projects, but the thing is that i cant compile this source. Errors below:
[Linker error] undefined reference to `UuidCreate@4'
[Linker error] undefined reference to `UuidToStringA@8'
[Linker error] undefined reference to `RpcStringFreeA@4'
ld returned 1 exit status
...\skype-api\Makefile.win [Build Error] [test.exe] Error 1

This example works with C++ Builder 5 fine, but i prefer Dev-C++. Any sugestions?

PS: sorry of my english, im not very good at it. smile.png


Does this help at all, there were some compile problems as well with Microsoft C++ 2005 Express Edition:

http://forum.skype.com/index.php?showtopic=54549
mike_pukuotukas_lt
No lucky sadsmile.png
TheUberOverlord
QUOTE(mike_pukuotukas_lt @ Tue Feb 27 2007, 15:22) [snapback]365563[/snapback]

No lucky sadsmile.png


Again, you are missing a reference to Rpcrt4.lib in your project the http://msdn2.microsoft.com/en-us/library/aa378483.aspx

Here is a fix I made for Microsoft Visual Studio C++ express. There maybe different syntax for your complier and project:

http://testing.onlytherightanswers.com/msgapitestfix.zip

#pragma comment(lib, "Rpcrt4.lib")
fpreto
QUOTE(taavet @ Fri May 28 2004, 14:10) [snapback]12703[/snapback]

Some examples to get you started using the Skype API:
* Example C++ code for Windows
* Example Python code for Linux
* Examples for OSX
Tools, API wrappers and tutorials are available from third parties. These can be found in the Development section of the Skype Extras Gallery. Please note that unless clearly marked as ‘Skype Certified’ these tools should be used at your own risk.
See also the API documentation.
//changed by ppmotskula on 2006-03-31


The Python Script is broken (under Ubuntu 7.04):

CODE
Traceback (most recent call last):
  File "skypeapiclient_linux.py", line 65, in <module>
    class Callback_obj(dbus.Object):
AttributeError: 'module' object has no attribute 'Object'


The DBus implementation under Python has changed. Also the Skype does not seems to apear as a DBus service (even with --enable-dbus --use-system-dbus), probably because the DBus implementation on Skype 1.3 is very outdated.
Sertys
QUOTE(fpreto @ Tue May 1 2007, 19:49) [snapback]389092[/snapback]

The Python Script is broken (under Ubuntu 7.04):

CODE
Traceback (most recent call last):
  File "skypeapiclient_linux.py", line 65, in <module>
    class Callback_obj(dbus.Object):
AttributeError: 'module' object has no attribute 'Object'


The DBus implementation under Python has changed. Also the Skype does not seems to apear as a DBus service (even with --enable-dbus --use-system-dbus), probably because the DBus implementation on Skype 1.3 is very outdated.



Yeah, unfortunately you're right. I'm running *SOME* ubuntu on that machine with distupgraded libdbus and python-dbus and the sample is not interpreting at all. The dbus api is excluding the term "service" already with a mistification on the dbus.Interface binding. I however managed to rewrite the script and use proper object calling, but Skype is nowhere to be found in the DBUS service listings. I shall keep digging.
miheygm
handshake.png Hi! Can you give me full example of broadcasting? Please.
aout
Hello,

I am new to Skype... Can anyone help me on how to connect to API using VB/ASP?

Thanks
MOSBAHAbdelkader
Hello,

Is it possible to use the Skype Api with the C language.

If yes are there examples.

thanks.
pkolmann
QUOTE(Sertys @ Thu May 31 2007, 03:01) [snapback]401101[/snapback]

Yeah, unfortunately you're right. I'm running *SOME* ubuntu on that machine with distupgraded libdbus and python-dbus and the sample is not interpreting at all. The dbus api is excluding the term "service" already with a mistification on the dbus.Interface binding. I however managed to rewrite the script and use proper object calling, but Skype is nowhere to be found in the DBUS service listings. I shall keep digging.


I have just tried to get the python example to run with latest 1.4 beta.

It works now again, sending stuff, but the receiving end seems broken. Or at least, I can't find the right connector, skype is expecting.

I hope this is useful for someone.
Philipp

EDIT: Thanks to this post (http://forum.skype.com/index.php?showtopic=89264) I was able to fix the dbus example.
Devang Mehta
Hi i want to set up a skype call using VB.net (VS 2005). But i couldn't find much help with VB.Net. I do not knw whr to start frm. Can someone put down basic VB.Net code to connect and pace a call. I have added Skype4ComLib reference to my existing project, but couln't move ahead. If someone can post a VB.Net example, would be a gr8 help.

Thnx,
Dr.Luiji at work
QUOTE(Kevin Langlois @ Sun May 22 2005, 19:19) [snapback]127136[/snapback]

HEY ! .....Check out http://www.khaoslabs.com/index.php?page=skypeapi for an easy-to-use COM wrapper for SKYPE.
Just a suggestion
-PointBlank

Hey link seems not work..
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.