Harnessing WinRT APIs
Harnessing WinRT APIs

by John Moore

Here's how developers can exploit WinRT APIs and the potential applications this approach may unlock

Developers are gaining experience with Windows Runtime (WinRT), an API set that provides a framework for Windows 8 and Windows RT applications.

Microsoft provides the WinRT APIs for building Windows Store apps. Those apps differ from traditional desktop apps in a couple of ways.

For instance, Windows Store apps incorporate a set of default styles that aim to make user interface components work well in touch scenarios, according to Microsoft. Supported languages include C++, C#, JavaScript and Visual Basic.

"There are several things that are significant for WinRT API," says Ilya Kretov, delivery manager and Microsoft Certified Professional Developer at DataArt, a custom software development company.

For one, WinRT API provides the means to easily develop all the features the Windows 8 application needs to have, Kretov says. In addition, the API set is integrated into the operating system and provides a convenient and effective way of working with resources, he adds. "It is possible to develop fast native applications," he says.

Kretov also notes that WinRT development has much in common with Windows Presentation Foundation (WPF) and Silverlight. That commonality makes it easy for any developer familiar with those technologies to master Microsoft's newer offering, he says.

Michael Lake, vice president of engineering at WillowTree Apps Inc., a developer in Charlottesville, Va., suggests that making WinRT easy to pick up will be important for Microsoft in convincing developers to adopt its technology. "They really need to…make use of developers' existing know-how," he says. "Any time you ask developers to familiarize themselves with something new, that is going to mean more time, and more time means more money."

WinRT Pluses

Brian Lagunas, product manager at Infragistics, a company that providers design and development tools and related services, says he has gained familiarity with the WinRT APIs and likes to use them on WPF applications.

"It is so much easier to access devices like webcams and audio devices" using WinRT versus Windows COM Interop, Lagunas says. Accomplishing tasks also requires less code when using WinRT APIs, he adds.

In a recent presentation at the 2013 Intel International Sales and Marketing Conference in Las Vegas, Eric Sardella, senior software engineer in Intel's Software and Services Group, cited WinRT for its "rich set of multimedia high-level APIs available for Media Apps." Sardella noted that the APIs capture audio and video from live sources, process image files, play/preview audio and video, and transcode video files. He says a WMV-to- MP4 transcoder involves just a few lines of code.

Using WinRT to Exploit Sensors

Developers can also use WinRT to tap the numerous sensors built into Ultrabooks and other mobile platforms.

"WinRT makes the work with sensors more convenient than before," Kretov says. "Previously, the only way to work with sensors was using the vendor's API. This way is, obviously, device specific and in some cases it could be rather difficult to obtain all the necessary information. So, the sensor-related functionality should have been rewritten for different vendors' API during development and verified in course of configuration testing."

DataArt has gained some experience with WinRT APIs. The company has been using them since July 2011, soon after the Windows 8 developer preview was released. "Since then, we have been following the evolution of the system and have already completed several projects," Kretov says.

Sensor-related classes are available in the Windows devices. Sensors namespace include: Accelerometer, Compass, Gyrometer, Inclinometer, LightSensor and OrientationSensor.

Lagunas points out that, in order for WinRT to access those sensors, a sensor's driver must be marked as PC-integrated.

Overall, mobile developers seem to view WinRT as a tool to make their jobs easier. Kretov says the fact that WinRT contains standard APIs for sensors, geolocation and multitouch makes life simpler for software developers. He emphasizes that the potential use of the WinRT APIs isn't limited to sensor APIs, however. The scope, he says, also includes "other cool features of Windows 8 apps like contracts, background services, multitouch, multiple orientations and resolutions."

John Moore has written about business and technology for more than 20 years. Moore's articles have appeared in Baseline, CIO.com, Federal Computer Week, iHealthBeat, and TechTarget. Areas of focus include cloud computing, health information technology, systems integration, and virtualization.

Programming & Software Development: "Harnessing WinRT APIs"