The purpose of this tip is to show you how to find the default Skype's account name.
I needed to code a function that extracts data from the default Skype account on a given computer. To do so, I first needed to locate the default account name. I found a simple way of doing so.
The Skype default account’s name is stored in a file named “shared.xml”. This file is stored inC:\users\username\AppData\Roaming\Skype\.
First, we need to find this location as the exact path we need to access varies based on username.
To do so, we use:
and pass CSIDL_APPDATA as its parameter.
According to MSDB, "The file system directory that serves as a common repository for application-specific data.".
So to get that path, we call:
This file is obviously an XML file. So the next step is to open "shared.xml" located in that path and extract from it the desired information.
To do so, we need an XML parser and RapidXML is the one I recommend. RapidXml is a very fast, open source XML parser which preserves its usability, is portable, is W3C compatible. It is an in-situ parser written in modern C++, with parsing speed approaching that of strlen function executed on the same data.
In order to find the default account's name, we first need to find in this file the “Account” element and inside of it to find the “default” element where the account name will be found.
Points of Interest
I have taken the opportunity to demonstrate a minimal MFC application, created by scratch and not using the Visual Studio Wizard, whilst containing only the necessary definitions and include files.
The source code which accompanies this tip was created and compiled under Visual Studio 2013 Ultimate.
Since this tip was published I was asked to add further instructions for obtaining stored Skype chat logs and other stored information and I plan to do that in my next tip or article.