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.
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
If 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
Feature 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”.
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
An 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
4: Windows 10 Notifications
I mentioned briefly that WinRT did not replace WinAPI, and that it instead was amalgamated into what we today know as UWP (Universal Windows Platform). Another facet of what Microsoft did was to greatly simplify tasks that were previously low-level and time consuming, making them easier to use and broadening their functionality.
Being notified about changes in the hardware, like someone ejecting a CD-ROM or plugging in a USB stick, is nothing new. But the notification layer in Windows 10 unifies a number of notification channels (not just visible notifications for the user) – including cloud services.
From a programming point of view, this makes life considerably easier. For example, let us say your application can store data through multiple services, both local and remote. Instead of you having to write separate signal handling for cloud and local, you can now unify much of this into a single, coherent strategy.
Note: This aspect of UWP is still under development by Microsoft, so there is still functionality that is due in the future, such as push notifications through BaaS (back-end as a service).
Toast notifications allows your app to inform the users about relevant information and timely events that they can take action upon inside your app; such as a new instant message, a new friend request, breaking news, or a calendar event. When the user “chases” the notification (by tapping or clicking on the toast to activate the app), the app should navigate the user to the page with the right context.
One of the new components in RAD Studio, is a component called TNotificationCenter. This simplifies how your application deals with local, multi-device notifications, including Windows 10 Toast notifications. This component merges notification functionality of all platforms, covering iOS, Android, OS X/macOS, and Windows 10 under one roof.
You can read more about how you can leverage notifications for all platforms here:
And there is a good introduction to the general principles of Toast Messages on MSDN:
5: Windows 10 VCL components
I mentioned that Delphi contains roughly 40 units that import and otherwise makes WinRT (UWP) functionality available to Delphi and C++Builder developers. There is a wealth of topics that are uniquely bound to Windows 10 (or that were introduced with Windows 8). We are sure to see plenty of additions to the component palette in the Delphi and C++Builder versions to come.
Out of the box you get some very nice components that are simply not present on older Windows versions like Windows 7. I know that there are still people using Windows 7 as their primary OS, and that some are reluctant to upgrade. But Microsoft officially shut down all update services last week – and Windows 7 is now officially retired/EOL.
So if you have been waiting for a nudge to upgrade, then now is the time to do so. I updated when Windows 10 revision 2 came out. It really is a completely different experience in every regard, and it is faster than Windows 7 (I know this because I updated directly without any changes to the hardware), so you will no doubt get a year or two extra out of your PC.
As for components you can drag & drop on a form, they are:
I also mentioned the new components for dealing with HD and SD graphics for decorating your applications (buttons, toolbars, imagelists, treeview et-al):
It’s also worth mentioning that Windows 10 has the BlueTooth API. This has been encapsulated in Delphi as a standard TBlueTooth component. Things like BlueTooth used to involve a lot of low-level operations, enumerating USB devices, locating BT adapter objects etc. But Delphi and C++Builder now offer a clean, user-friendly approach to working with BlueTooth directly.
If you are unfamiliar with the Bluetooth support, you can read up here:
If you think the list of new components is underwhelming, please keep in mind that Windows 10 is still young. The VCL has been tried and tested by time and represents the fastest and most efficient way of building native Windows applications without equal. All those existing VCL controls also work great on Windows 10. And the key behind the VCL frameworks efficiency in this matter, has to do with its adaptable architecture. In other words, encapsulating the unique features of Windows 10 is a piece of cake for the VCL.
You can have a look at the documentation for Windows 10 components in RAD Studio Rio here:
In this overview of how Delphi and C++Builder tap directly into Windows 10 and provide you with a clear-cut path to use those features in your applications — we have barely scratched the surface.
When I was preparing for this article and going over the WinAPI namespace, it didn’t require much imagination to see how the wealth of available features exposed through UWP, will result in some amazing components and RTL add-ons in the near future.
But there is a balance in this material that we developers often forget, namely that Embarcadero has a responsibility to its technology partners. There must be room for third party developers to write components and contribute to the community. This is something that I feel Embarcadero has always handled right. They make sure that you as a customer get access to the latest features; they incorporate changes in the underlying sub-strata whenever its needed; and they avoid competing with themselves by allowing their technology partners to build component packages and solutions.
Delphi and C++Builder has always enjoyed a rich ecosystem of components and technologies. No matter what you might need, from kernel level drivers all the way up to cloud service integration, there is always a solution to be found. Sometimes as a commercial component set, but more often than not as a free solution by the community itself. Access to insight is one of the reasons why Delphi remains so popular.
Another factor that I love about Delphi 10.x (covering the past 3 major versions) is that there have been radical optimization done on the run-time library. Affecting the performance of the VCL and FMX frameworks independently. In some cases we are talking about a speed boost of 100%. So the final chapter on Delphi performance has not been written.
Delphi is going from strength to strength, and I feel the community is going through a form of revival. We are seeing a steady influx of new developers, as well as developers returning to Delphi and C++Builder for various reasons — but the most common reason I hear is that there simply is no equal when it comes to Windows software development. Delphi is a unique formula, perfected over decades. There simply is no other language nor product that offers the same delicate balance between speed, productivity and quality. For Windows 10 development, Delphi is the best software authoring system the platform has ever, end of story.
And there has never been a better time to be a Delphi developer!
Next, learn more about AMD’s Ryzen 9 5950X and Threadripper 3990X as well as the productivity of these modern desktop processors when combined with Delphi.
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition