Help - Search - Members - Calendar
Full Version: Fixed bug in C++ API Example when using Studio Express
Skype Community > English > Development, Betas and Skype Garage > Skype Public API
TheUberOverlord
Found a bug in the msgapitest C++ example when using the Microsoft Visual C++ 2005 Studio express edition ("The Free edition from Microsoft")

From the C++ API example located on this page:

https://developer.skype.com/Docs/ApiDoc/Usi..._API_on_Windows

From this link:

https://developer.skype.com/Download/Sample...example_win.zip

Here is a one line change that will allow it to compile correctly:

http://testing.onlytherightanswers.com/msg...gapitestfix.zip

Instructions to create a New project using the source code:

1. Create a folder called msgapitest
2. Unzip the file above to that folder.
3. Launch C++ Studio Express
4. Click on File, New, Project from existing code
5. Visual C++ should be the selected type of project, click next
6. Click the browse button and select the msgapitest folder
7. In the project name field enter msgapitest, click next
8. In the project type field select "Console Application Project"
9. Click Finish
10. Click Build, select build project.

If all goes well you should see Build Succeeded. You can close C++ Studio Express now.

Open the msgapitest folder there should be many more files there as well as a new folder called Debug. Open the Debug folder and there should now be a msgapitest.exe file there.

Make sure Skype is started and click on the msgapitest.exe file and a console window will open. The default has debug messages on so you can see "Raw message numbers" this can be turned off by entering #dbgoff in the console window, and turned back on by entering #dbgon in the console window.

You can do normal things on Skype and see what is going back and forth, and NOW you can modify this source code with your changes and do some testing using C++ Express.

You can also enter commands. Here are just six of many possible command Examples:

CALL echo123 <Enter Key>

Will call the test call and you can see messages caused by calling.

MESSAGE username text <Enter Key>

Change username to a real skype username and it will start a text chat if that user is available.

SET USERSTATUS AWAY

Will change current user status to away.

SET USERSTATUS ONLINE

Will change current user status to online.

MINIMIZE

Minimizes Skype to the toolbar.

FOCUS

Raises Skype Window from the toolbar.

Also don't forget you could use command Indentifiers as well to match request/response simply by adding a tag of # and a Alpha or numeric with almost all commands.

More here on that:

https://developer.skype.com/Docs/ApiDoc/Com...and_identifiers

You basically can use and test almost any of the API commands with this utility and look at the message flows from/to the API. The debug version of this utility is 44k Small, the Release version is 9k small.

So as you can see there is no reason NOT to try and build any interface you are doing on the client side in C++, it is easy to do, and with Microsoft Visual Studio C++ 2005 Express it can be done for free as well. Here is a link to get C++ Express for free if you need it:

http://msdn.microsoft.com/vstudio/express/visualc/

Just think of the QUICK testing advanage of using this tool, it is very easy to modify, even if you will use another langauge, this will open the RAW API for you while you are testing.


Here is a list of API commands that can be used:

https://developer.skype.com/Docs/ApiDoc/FrontPage

It may be hard to enter commands in the console window with the debug on option so if you are going to be entering commands you may wish to do the #dbgoff and then turn it back on afterwards.

Look at the msgapitest C++ source code to see other options and to make changes.

Here is sample output from the utility using the commands listed above, note while calls are active duration messages are sent every second by the API showing the total number of seconds passed since the call started:

CODE


!!! Pending authorization

!!! Try connect now (API available); issue #connect

!!! Connected; to terminate issue #disconnect

Message from Skype(0): CONNSTATUS ONLINE

Message from Skype(0): CURRENTUSERHANDLE theuberoverlord

Message from Skype(0): USERSTATUS ONLINE



CALL echo123



Message from Skype(0): CALL 519 STATUS ROUTING

Message from Skype(0): CALL 519 STATUS ROUTING

Message from Skype(0): CALL 519 STATUS ROUTING

Message from Skype(0): CALL 519 STATUS RINGING

Message from Skype(0): CALL 519 STATUS INPROGRESS

Message from Skype(0): CALL 519 DURATION 1

Message from Skype(0): CALL 519 DURATION 2

Message from Skype(0): CALL 519 DURATION 3

Message from Skype(0): CALL 519 DURATION 4

Message from Skype(0): CALL 519 DURATION 5

Message from Skype(0): CALL 519 STATUS FINISHED



MESSAGE echo123 Hi are you there?



Message from Skype(0): MESSAGE 526 STATUS SENDING

Message from Skype(0): CHAT #theuberoverlord/$echo123;32827a251fc98284 NAME #the

uberoverlord/$echo123;32827a251fc98284

Message from Skype(0): MESSAGE 525 STATUS SENDING

Message from Skype(0): MESSAGE 526 STATUS SENDING

Message from Skype(0): CHAT #theuberoverlord/$echo123;32827a251fc98284 STATUS DIALOG

Message from Skype(0): CHAT #theuberoverlord/$echo123;32827a251fc98284 MEMBERS echo123 theuberoverlord

Message from Skype(0): CHAT #theuberoverlord/$echo123;32827a251fc98284 ACTIVEMEMBERS theuberoverlord

Message from Skype(0): CHAT #theuberoverlord/$echo123;32827a251fc98284 STATUS DIALOG

Message from Skype(0): CHAT #theuberoverlord/$echo123;32827a251fc98284 TIMESTAMP

1148620140

Message from Skype(0): CHAT #theuberoverlord/$echo123;32827a251fc98284 MEMBERS e

cho123 theuberoverlord

Message from Skype(0): CHAT #theuberoverlord/$echo123;32827a251fc98284 FRIENDLYN

AME Echo / Sound Test Service | Hi are you there?

Message from Skype(0): CHAT #theuberoverlord/$echo123;32827a251fc98284 POSTERS t

heuberoverlord

Message from Skype(0): CHAT #theuberoverlord/$echo123;32827a251fc98284 FRIENDLYN

AME Echo / Sound Test Service | Hi are you there?

Message from Skype(0): CHAT #theuberoverlord/$echo123;32827a251fc98284 STATUS LE

GACY_DIALOG

Message from Skype(0): MESSAGE 525 STATUS SENT

Message from Skype(0): CHAT #theuberoverlord/$echo123;32827a251fc98284 ACTIVEMEM

BERS echo123 theuberoverlord

Message from Skype(0): MESSAGE 526 STATUS SENT



SET USERSTATUS AWAY



Message from Skype(0): USERSTATUS AWAY

Message from Skype(0): USER theuberoverlord ONLINESTATUS AWAY

Message from Skype(0): USERSTATUS AWAY



SET USERSTATUS ONLINE



Message from Skype(0): USERSTATUS ONLINE

Message from Skype(0): USER theuberoverlord ONLINESTATUS ONLINE

Message from Skype(0): USERSTATUS ONLINE



MINIMIZE



Message from Skype(0): MINIMIZE



FOCUS



Message from Skype(0): FOCUS



Message from Skype(0): GROUP 205 NROFUSERS 1

Message from Skype(0): GROUP 205 NROFUSERS_ONLINE 1

Message from Skype(0): GROUP 209 NROFUSERS_ONLINE 1

Message from Skype(0): GROUP 208 NROFUSERS_ONLINE 1

Message from Skype(0): GROUP 207 NROFUSERS_ONLINE 1

Message from Skype(0): GROUP 203 NROFUSERS_ONLINE 1

Message from Skype(0): GROUP 201 NROFUSERS_ONLINE 0

Message from Skype(0): GROUP 199 NROFUSERS_ONLINE 1

Message from Skype(0): GROUP 205 USERS echo123



#a FOCUS



Message from Skype(0): #a FOCUS





The Entire Visual C++ express project files can be downloaded here if needed:

http://testing.OnlyTheRightAnswers.com/msgapitest.zip

Was this helpful?
triona.carey_
very interesting post - tx for bringing this to our attention and for the huge effort you have made. I don't have to time to go into it in detail now but will come back to it over the weekend - see what needs doing to fix things.
TheUberOverlord
Glad to be of some help, it is a WONDERFUL product and very easy to monitor the API with many interfaces that seem to be under used by developers.

Not many VoIP products are this user friendly, this one tops them all, and I have just been playing with it for a week, lol.

Will be happy to post open source examples for people who need help, or just want to lean how flexable and easliy interfaced it is.

For those new to programming, or curious, the API won't Bite smile.png , take it slow it is easy to test and use.

I think what makes this little uitility so special is that it speeds up testing, because you can see if maybe your code is doing something wrong during testing, and it can be changed very fast. Also it allows you to get an inside peek at normal API flow.

If you have very complex senario's that require the need for batch like files to test request/response logic, you can still use http://skypetracer.com and it does have source code but it is MFC "Microsoft Foundation Class" based and even the Standard ++ Studio Suite is not cheap. At least some of the people on a tight budget can have a method to do testing with this for free.

More devlopers, better products, lower prices. Did I say that? ("Slap's Himself") :roll:

Don
TimKen_
This is the most helpfull post ever !!!
Thank you so much for the C++ Api example !!!! bigsmile.png
This is exactly what I was looking for!
ZOverLord you rule !!
TheUberOverlord
QUOTE(TimKen)
This is the most helpfull post ever !!!
Thank you so much for the C++ Api example !!!! bigsmile.png  
This is exactly what I was looking for!
ZOverLord you rule !!


You are very welcome bigsmile.png If you have any interest in interfacing to Skype via Web pages there is also an example to do this here as well:

http://forum.skype.com/viewtopic.php?t=54826

Just shout if I can be of any help.
funfox_
[quote=ZOverLord]Just shout if I can be of any help.[/quote]

HEEEEELP !! ! ! ! !

I'm trying to get the example working, but I get errors, from you exemple as from the skype site example of msgapitest :

1>------ Début de la génération : Projet : msgapitest, Configuration : Debug Win32 ------
1>Édition des liens en cours...
1>msgapitest.obj : error LNK2019: symbole externe non résolu __imp__RegisterClassA@4 référencé dans la fonction "bool __cdecl Initialize_CreateWindowClass(void)" (?Initialize_CreateWindowClass@@YA_NXZ)
1>msgapitest.obj : error LNK2019: symbole externe non résolu __imp__DefWindowProcA@16 référencé dans la fonction "long __stdcall SkypeAPITest_Windows_WindowProc(struct HWND__ *,unsigned int,unsigned int,long)" (?SkypeAPITest_Windows_WindowProc@@YGJPAUHWND__@@IIJ@Z)
1>msgapitest.obj : error LNK2019: symbole externe non résolu __imp__PostQuitMessage@4 référencé dans la fonction "long __stdcall SkypeAPITest_Windows_WindowProc(struct HWND__ *,unsigned int,unsigned int,long)" (?SkypeAPITest_Windows_WindowProc@@YGJPAUHWND__@@IIJ@Z)
1>msgapitest.obj : error LNK2019: symbole externe non résolu __imp__UnregisterClassA@8 référencé dans la fonction "void __cdecl DeInitialize_DestroyWindowClass(void)" (?DeInitialize_DestroyWindowClass@@YAXXZ)
1>msgapitest.obj : error LNK2019: symbole externe non résolu __imp__CreateWindowExA@48 référencé dans la fonction "bool __cdecl Initialize_CreateMainWindow(void)" (?Initialize_CreateMainWindow@@YA_NXZ)
1>msgapitest.obj : error LNK2019: symbole externe non résolu __imp__DestroyWindow@4 référencé dans la fonction "void __cdecl DeInitialize_DestroyMainWindow(void)" (?DeInitialize_DestroyMainWindow@@YAXXZ)
1>msgapitest.obj : error LNK2019: symbole externe non résolu __imp__DispatchMessageA@4 référencé dans la fonction "void __cdecl Global_MessageLoop(void)" (?Global_MessageLoop@@YAXXZ)
1>msgapitest.obj : error LNK2019: symbole externe non résolu __imp__TranslateMessage@4 référencé dans la fonction "void __cdecl Global_MessageLoop(void)" (?Global_MessageLoop@@YAXXZ)
1>msgapitest.obj : error LNK2019: symbole externe non résolu __imp__GetMessageA@16 référencé dans la fonction "void __cdecl Global_MessageLoop(void)" (?Global_MessageLoop@@YAXXZ)
1>msgapitest.obj : error LNK2019: symbole externe non résolu __imp__PostMessageA@16 référencé dans la fonction "void __cdecl Global_InputProcessingThread(void *)" (?Global_InputProcessingThread@@YAXPAX@Z)
1>msgapitest.obj : error LNK2019: symbole externe non résolu __imp__SendMessageA@16 référencé dans la fonction "void __cdecl Global_InputProcessingThread(void *)" (?Global_InputProcessingThread@@YAXPAX@Z)
1>msgapitest.obj : error LNK2019: symbole externe non résolu __imp__RegisterWindowMessageA@4 référencé dans la fonction _main
1>Debugmsgapitest.exe : fatal error LNK1120: 12 externes non résolus
1>Le journal de génération a été enregistré à l'emplacement "file://c:Documents and Settingsf.blochBureaumsgapitestmsgapitestDebugBuildLog.htm"
1>msgapitest - 13 erreur(s), 0 avertissement(s)
========== Génération : 0 a réussi, 1 a échoué, 0 mis à jour, 0 a été ignoré ==========



translated in english : "symbole externe non résolu" means "external symbol not resolved" (more or less)

i tried to contact you by skype, but you are offline :s

i don't understant why VC++2005 express doesn't compile the example !! :'(

thanks by advance to anybody that could help me :s
TheUberOverlord
It does compile using this example. Did you install the Windows SDK with Express?

Also did you follow the instructions about modifying the lib's, includes when installing express?
TheUberOverlord
[quote=funfox][quote=ZOverLord]Just shout if I can be of any help.[/quote]

HEEEEELP !! ! ! ! !

I'm trying to get the example working, but I get errors, from you exemple as from the skype site example of msgapitest :

1>------ Début de la génération : Projet : msgapitest, Configuration : Debug Win32 ------
1>Édition des liens en cours...
1>msgapitest.obj : error LNK2019: symbole externe non résolu __imp__RegisterClassA@4 référencé dans la fonction "bool __cdecl Initialize_CreateWindowClass(void)" (?Initialize_CreateWindowClass@@YA_NXZ)
1>msgapitest.obj : error LNK2019: symbole externe non résolu __imp__DefWindowProcA@16 référencé dans la fonction "long __stdcall SkypeAPITest_Windows_WindowProc(struct HWND__ *,unsigned int,unsigned int,long)" (?SkypeAPITest_Windows_WindowProc@@YGJPAUHWND__@@IIJ@Z)
1>msgapitest.obj : error LNK2019: symbole externe non résolu __imp__PostQuitMessage@4 référencé dans la fonction "long __stdcall SkypeAPITest_Windows_WindowProc(struct HWND__ *,unsigned int,unsigned int,long)" (?SkypeAPITest_Windows_WindowProc@@YGJPAUHWND__@@IIJ@Z)
1>msgapitest.obj : error LNK2019: symbole externe non résolu __imp__UnregisterClassA@8 référencé dans la fonction "void __cdecl DeInitialize_DestroyWindowClass(void)" (?DeInitialize_DestroyWindowClass@@YAXXZ)
1>msgapitest.obj : error LNK2019: symbole externe non résolu __imp__CreateWindowExA@48 référencé dans la fonction "bool __cdecl Initialize_CreateMainWindow(void)" (?Initialize_CreateMainWindow@@YA_NXZ)
1>msgapitest.obj : error LNK2019: symbole externe non résolu __imp__DestroyWindow@4 référencé dans la fonction "void __cdecl DeInitialize_DestroyMainWindow(void)" (?DeInitialize_DestroyMainWindow@@YAXXZ)
1>msgapitest.obj : error LNK2019: symbole externe non résolu __imp__DispatchMessageA@4 référencé dans la fonction "void __cdecl Global_MessageLoop(void)" (?Global_MessageLoop@@YAXXZ)
1>msgapitest.obj : error LNK2019: symbole externe non résolu __imp__TranslateMessage@4 référencé dans la fonction "void __cdecl Global_MessageLoop(void)" (?Global_MessageLoop@@YAXXZ)
1>msgapitest.obj : error LNK2019: symbole externe non résolu __imp__GetMessageA@16 référencé dans la fonction "void __cdecl Global_MessageLoop(void)" (?Global_MessageLoop@@YAXXZ)
1>msgapitest.obj : error LNK2019: symbole externe non résolu __imp__PostMessageA@16 référencé dans la fonction "void __cdecl Global_InputProcessingThread(void *)" (?Global_InputProcessingThread@@YAXPAX@Z)
1>msgapitest.obj : error LNK2019: symbole externe non résolu __imp__SendMessageA@16 référencé dans la fonction "void __cdecl Global_InputProcessingThread(void *)" (?Global_InputProcessingThread@@YAXPAX@Z)
1>msgapitest.obj : error LNK2019: symbole externe non résolu __imp__RegisterWindowMessageA@4 référencé dans la fonction _main
1>Debugmsgapitest.exe : fatal error LNK1120: 12 externes non résolus
1>Le journal de génération a été enregistré à l'emplacement "file://c:Documents and Settingsf.blochBureaumsgapitestmsgapitestDebugBuildLog.htm"
1>msgapitest - 13 erreur(s), 0 avertissement(s)
========== Génération : 0 a réussi, 1 a échoué, 0 mis à jour, 0 a été ignoré ==========



translated in english : "symbole externe non résolu" means "external symbol not resolved" (more or less)

i tried to contact you by skype, but you are offline :s

i don't understant why VC++2005 express doesn't compile the example !! :'(

thanks by advance to anybody that could help me :s[/quote]

OK, here is your problem. you for sure did not do Step 4 here:

http://msdn.microsoft.com/vstudio/express/...ualc/usingpsdk/

quote:

"Step 4: Update the corewin_express.vsprops file.

One more step is needed to make the Win32 template work in Visual C++ Express. You need to edit the corewin_express.vsprops file (found in C:Program FilesMicrosoft Visual Studio 8VCVCProjectDefaults) and

Change the string that reads:

AdditionalDependencies="kernel32.lib" to

AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib"

Make sure you followed all the other steps as well in the link above when you installed express and make sure you set the project as a "Console" application.

You should get a clean compile with 11 warnings.
funfox_
Thank you sooooo much !!!


i works !

i hadn't managed to make anything work, and I didn't understood why...

i had managed to do step 3 by myself, when I had errors from missing files... but I would never had found the step 4 alone, and I had seen nowhere links to this tutorial page...

now I will be able to test everything and see what I can modify wink.png

Thanks again !
TheUberOverlord
QUOTE(funfox)
Thank you sooooo much !!!


i works !

i hadn't managed to make anything work, and I didn't understood why...

i had managed to do step 3 by myself, when I had errors from missing files... but I would never had found the step 4 alone, and I had seen nowhere links to this tutorial page...

now I will be able to test everything and see what I can modify wink.png

Thanks again !


You are very welcome, glad I could help :-)
priyanka2k3_
Hi!! can u please send me the same code in asp.net....plz do so as soon as possible!!
Abhishek.Murthy
QUOTE(ZOverLord @ Wed Jun 28 2006, 15:30) [snapback]267592[/snapback]

You are very welcome, glad I could help :-)



Hi,

I currently have VC++ 2008 Express edition on Vista running on 32-bit Lenovo Laptop.

I built the project as given above but did NOT get a clean build:

Following is the log:
*******************************************************************************
Build Log


Build started: Project: msgapitest, Configuration: Debug|Win32

Command Lines


Creating temporary file "c:\Users\Abhishek Murthy\Desktop\msgapitestfix\Debug\RSP00000145402488.rsp" with contents
[
/Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /Gm /EHsc /RTC1 /MDd /Fo"Debug\\" /Fd"Debug\vc90.pdb" /W3 /c /Wp64 /ZI /TP ".\msgapitest.cpp"
]
Creating command line "cl.exe @"c:\Users\Abhishek Murthy\Desktop\msgapitestfix\Debug\RSP00000145402488.rsp" /nologo /errorReport:prompt"

Output Window


Compiling...
cl : Command line warning D9035 : option 'Wp64' has been deprecated and will be removed in a future release
msgapitest.cpp
c:\users\abhishek murthy\desktop\msgapitestfix\msgapitest.cpp(76) : error C2664: 'ReadConsoleA' : cannot convert parameter 5 from 'LPVOID' to 'PCONSOLE_READCONSOLE_CONTROL'
Conversion from 'void*' to pointer to non-'void' requires an explicit cast
c:\users\abhishek murthy\desktop\msgapitestfix\msgapitest.cpp(283) : warning C4267: '=' : conversion from 'size_t' to 'DWORD', possible loss of data

Results


Build log was saved at "file://c:\Users\Abhishek Murthy\Desktop\msgapitestfix\Debug\BuildLog.htm"
msgapitest - 1 error(s), 2 warning(s)


***********************************************************************************

I can either compile in VC++ 2008 or Dev C++. Compiling in Dev C++ has the linker error problem and VC++ 2005 isnt compatible with Vista!


Plz help!!!! SOS!! crying.png

Abhishek

Abhishek.Murthy
QUOTE(Abhishek.Murthy @ Mon Apr 7 2008, 03:01) [snapback]514572[/snapback]

Hi,

I currently have VC++ 2008 Express edition on Vista running on 32-bit Lenovo Laptop.

I built the project as given above but did NOT get a clean build:

Following is the log:
*******************************************************************************
Build Log


Build started: Project: msgapitest, Configuration: Debug|Win32

Command Lines


Creating temporary file "c:\Users\Abhishek Murthy\Desktop\msgapitestfix\Debug\RSP00000145402488.rsp" giggle.png with contents
[
/Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /Gm /EHsc /RTC1 /MDd /Fo"Debug\\" /Fd"Debug\vc90.pdb" /W3 /c /Wp64 /ZI /TP ".\msgapitest.cpp"
]
Creating command line "cl.exe @"c:\Users\Abhishek Murthy\Desktop\msgapitestfix\Debug\RSP00000145402488.rsp" /nologo /errorReport:prompt"

Output Window


Compiling...
cl : Command line warning D9035 : option 'Wp64' has been deprecated and will be removed in a future release
msgapitest.cpp
c:\users\abhishek murthy\desktop\msgapitestfix\msgapitest.cpp(76) : error C2664: 'ReadConsoleA' : cannot convert parameter 5 from 'LPVOID' to 'PCONSOLE_READCONSOLE_CONTROL'
Conversion from 'void*' to pointer to non-'void' requires an explicit cast
c:\users\abhishek murthy\desktop\msgapitestfix\msgapitest.cpp(283) : warning C4267: '=' : conversion from 'size_t' to 'DWORD', possible loss of data

Results


Build log was saved at "file://c:\Users\Abhishek Murthy\Desktop\msgapitestfix\Debug\BuildLog.htm"
msgapitest - 1 error(s), 2 warning(s)
***********************************************************************************

I can either compile in VC++ 2008 or Dev C++. Compiling in Dev C++ has the linker error problem and VC++ 2005 isnt compatible with Vista!
Plz help!!!! SOS!! crying.png

Abhishek giggle.png



Dont worry guys i got the issue!

Line 76 needs a small change dont know why! giggle.png


//fReadConsoleResult=ReadConsole( hGlobal_PromptConsoleHandle,
// (LPVOID)pacPromptBuffer, uiMaxLength, &ulCharactersRead, (LPVOID)0);

becomes

fReadConsoleResult=ReadConsole( hGlobal_PromptConsoleHandle,
(LPVOID)pacPromptBuffer, uiMaxLength, &ulCharactersRead, NULL);


Note the change in the 5th param for ReadConsole function.


Thank you
Abhishek yes.png
TheUberOverlord
You can download the lastest version of Microsoft Visual C++ 2008 Express edition here:

http://www.microsoft.com/express/vc/

Here is the modified project for msgapitest that compiles with Microsoft Visual C++ 2008 Express:



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