O'Reilly logo

Mastering Windows 8 C++ App Development by Pavel Yosifovich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Windows Runtime Library

The Calendar usage example worked, but the code required was pretty verbose. The Windows Runtime Library (WRL) is a set of helper classes and functions that make it easier to work with WinRT types, both as a client and as a server (creator of components). WRL uses standard C++ (no non-standard extensions), keeping things pretty close to the metal. Let's see how we can simplify the Calendar example by using WRL.

First, we need to include the WRL headers; there is a main header and a helper with some convenient wrappers:

#include <wrl.h>
#include <wrl/wrappers/corewrappers.h>

Next, we'll add some using statements to shorten the code:

using namespace Windows::Foundation; using namespace Microsoft::WRL; using namespace Microsoft::WRL::Wrappers; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required