Issue link:

Contents of this Issue


Page 1 of 15

Working with C++ in the world of Windows Store Apps T raditional Windows C++ develop- ment is powered by Win32 API calls. With Windows 8 platforms, how- ever, applications must call a set of components named the Windows Runtime APIs. These components are also referred to as the WinRT API. This API is avail- able for various languages: C#, VB, JavaScript, and C++. For C++ developers, there are two options: C++/CX or standard ISO C++. The first option, C++/CX, is a set of compiler extensions with the existing syntax of the C++/CLI plus ^ and % characters. C++/CX generates native code and hides the plumbing of WinRT. C++/ CX is very well documented with samples. The other option is to choose standard C++ pro- gramming with a new library: Windows Run- time Library (WRL). This is the option Microsoft uses to develop WinRT APIs. Windows Runtime Library WRL is the successor of the popular Active Template Library (ATL), which allows develop- ers to simplify the programming of COM com- ponents. WRL is inspired by ATL: It provides C++ templates and internally uses meta-pro- gramming and modern C++ techniques to easily develop new COM components. The source code of WRL is shipped as C++ headers with the Windows SDK. WRL is documented in MSDN (, but there are few samples. Enhancements to the COM Technology Windows 8 brings new features to the COM technology with the new IInspectable interface that defines three new methods: GetIids, GetRuntimeClassName, and GetTrustLevel. The Windows Runtime is powered by COM, but it does not embrace the OLE technology. Everything relies on IIn- spectable, which inherits from IUnknown. There is no support for the IDispatch inter- face, ActiveX controls, or connection points. Importantly, the VARIANT data-type is not supported in Windows Store Apps. But there is a new Windows string type named HSTRING. There are also a lot of new inter faces that cover various aspects like asynchronous operations, collections con- tainers, and iterators that are exposed for all the languages. For the VB and C# languages, asynchronous operations are handled by async and await keywords. Collections are mapped to .NET framework interfaces like IList or IDictionary. The HSTRING data-type is mapped to System. String for .NET languages. June 2014 2 Previous Next Previous Next Download Download Register Register Subscribe Subscribe Previous Next Previous Next by Christophe Pichaud DOWNLOAD PDF Using C++ and COM with WinRT

Articles in this issue

Links on this page

view archives of InformationWeek - Dr_Dobbs_TD_5_14