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; ...