In my previous post I focused on InterBase 2020 and outlined five good reasons why InterBase should be your next database engine. In this post I want to look at five awesome additions to Delphi that help you write lean, modern and fully compliant Windows 10 applications.

To the average non-technical computer user, Windows 10 might seem as just another Windows version. I still hear both non-technical users and developers ask why they should leave Windows 7 behind. What exactly is so unique about Windows 10?

In order to understand why Windows 10 is awesome, we first have to take a step back to the previous edition of Windows, namely Windows 8.

A bit of context

At the time when Windows 8 was the latest thing, Microsoft was still active in the mobile market, and Windows 8 represented a substantial refactoring of the Windows family. Microsoft made no secret of their plans to eventually retire x86 in favour of ARM (which is still a goal for both Microsoft and Apple), and in order to deliver said platform transparently, the OS was to be engineered from the ground up.

Windows 10 Qualcomm ARM

Above: QualComm produces some of the most powerful ARM SoC (system on a chip) available. The SnapDragon 800 series delivers performance close to Intel i5, yet cost a fraction of the price. The SnapDragon SoC is used in Microsoft Surface tabs, and also powers the latest Samsung Galaxy Note 10.

The result of this effort was WinRT (Windows Runtime), a chipset agnostic architecture that, once adopted, enabled developers to write applications that could be compiled for any CPU, providing the code was source-compatible (not unlike FireMonkey and its abstraction layer over desktop, mobile and embedded). The idea was initially to retire the aging WinAPI and thus make the entire Windows eco-system portable. But WinRT has not replaced WinAPI, instead it co-exists and compliments the system.

Universal Windows Platform (UWP)

Needless to say the Windows 8 journey did not go as Microsoft had planned. They took Windows Mobile off the market (which is a great shame, Windows Mobile was wonderful to use) and decided to focus on what they do best; namely the Windows desktop.

UWP (universal windows platform) can be seen as a kind of successor to WinRT. It incorporates the same technology (so WinRT is still there) except it has broader implications and embrace more diverse technologies. The most important being that it allows other languages, and developers that don't use Visual Studio to co-exist without the restrictions of Windows 8 (WinRT was C++ only). Microsoft also added an emulation layer to UWP, to make sure applications written for x86 and WinAPI can seamlessly run on ARM.

I should underline that Delphi has support for the WinRT APIs that are now an intrinsic part of Windows 10. There are some 40 units in the VCL (under the WinAPI.* namespace) that let you work directly with that aspect of Windows. As well as components written especially for Windows 10, that we will cover briefly in this post.

Right then. Lets jump into my top five features and have a closer look!

1: Scaling and DPI awareness

DPI awareness is now a 2 click operationIf you have updated to Windows 10 you have undoubtedly noticed that graphics are smoother than under Windows 8 (and especially Windows 7), and that Windows will scale form content if you are using a monitor that supports high DPI. This feature goes deeper than you might expect, because users can have both HD and SD capable monitors connected to the same machine - and Windows 10 will ensure that applications look their best regardless of DPI count.

Support for DPI awareness for monitors, has to be defined in the application manifest, but this is now a part of your project options inside the Rad Studio IDE. So making your desktop application DPI aware is nothing more than a 2-click operation.

On the component side (or form decoration if you will) you can add support for HD graphics through the latest TImageCollection and TVirtualImageList. These components simplify support for HD displays when available - and fall back to older SD (low-res) glyphs when not available.

You can read more about DPI awareness and the parts of the VCL that this affects here:

An in-depth look at TImageCollection and TVirtualImageList can be found here:

2: UWP contracts

UWP ContractsFeature detection used to be a difficult, low-level task. And since Windows 10 supports several CPU architectures (e.g x86 and ARM), detecting specific hardware features for multiple device families adds considerable headache to an already complicated task. This is one of the aspects that WinRT / UWP has greatly alleviated, through the notion of contracts.

The concept of “contracts” under UWP is that applications should better adapt to their surroundings by investigating its features.

For example, a graphics program can expose a camera function if the device has a camera attached - and omit that button or option if no camera is there (adaptive UI). The contract part is a way of telling Windows “let me know when this condition becomes true”.

Universal Windows Platform (UWP)This technology might not seem that important at first glance, but when you factor in that UWP covers devices like Xbox, Hololens, and Surface (Tablet PC), being able to detect and respond to the available features is quite important.

The fundamental idea behind adaptive applications is that your app checks for the functionality (or feature) it needs, and only uses it when available. The traditional way of doing this is by checking the OS version and then use those APIs. With Windows 10, your app can check at runtime, whether a class, method, property, event, or API contract is supported by the current operating system. If so, the app can then call the appropriate API

RAD Studio provides WinRT API mappings and Object Pascal interfaces, and this delivers support for various Windows 10 services, contracts included. So through Delphi you can access this feature directly via the exact same methods other languages use.

You can read more about some of the additions for Windows 10 that Rad Studio provides here:

There is a good overview of contracts you can use on MSDN:

And a very nice article on how to use the API at Microsoft’s website here:

3: Deploy to Microsoft Store

Microsoft StoreAn integrated appstore (or package manager) was first made popular by Linux, and later commercialized by Apple. A good software store where applications can immediately be purchased and installed, that then takes care of updates automatically is a wonderful thing. Today, all major operating systems have a built-in app store, Windows 10 included.

When you write applications that should be sold or distributed through the Microsoft Store, the app must be packaged in a particular way (*.appx package files). Just like apps for macOS, iOS, and Android must be provisioned and signed, so must applications for the Windows 10 store. And RAD Studio makes this very easy. In fact, the process is more or less identical for the 3 stores in question (Google Play, Appstore, Microsoft Store).

Microsoft Store support has been a part of Rad Studio since version 10.1 (currently at 10.3), so getting your products quickly to market has never been easier.

Click here for a more in-depth look at how to package your app for Windows 10 store:

Or check out this short video presentation