http://msdn.microsoft.com/en-US/library/windows/apps/hh701480?cs-save-lang=1&cs-lang=cpp#code-snippet-2