Modernizing Delphi VCL apps for Windows 10 – part 2

This post follows on from part one: which in itself is a recap of my recent webinar, the replay of which can be found here:

Windows 10, the subtle bits

The great thing about Delphi is that it’s totally rock solid. I mean bullet proof, runs for ever, doesn’t need a bunch of dependencies, keeps on going for ever solid.

Because of that there’s a lot of legacy code out there. Many millions of lines of Delphi code, quietly doing its thing without fuss or drama. That’s great, but of course, the world keeps on spinning and eventually Moore’s Law means that while our programs work the environment in which they operate has changed.

Often these changes are in fashions of user interface look and feel such as new colors and the adoption or abandonment of passing trends like skeuomorphism or super-flat designs mean our older apps start to look very dated, often breathtakingly quickly as a new version of Windows wobbles its way down the now-ubiquitous always-on internet.

One of the most subtle changes to come about is the advent of 64bit Windows. For many people it happened silently. They bought a new laptop (75% of computer sales in 2018 were either laptops or tablet devices) and that laptop, in the last few years at least, ran a 64bit version of Windows 10.

Now, increasingly, I am finding that many of our corporate customers are looking to only run 64bit versions of apps. This means, if your app or particularly Windows service, is not 64bit then the customer will not allow it on their system. I did a rough count earlier via our support techs training or installing today and it was 3 of 10 servers who expressed either a preference or mandated that the system be 64bit only.

So, your Delphi 7, 2009, XE 1, 2, 3 etc apps are in trouble as they are using 32bit architecture.

Luckily, Delphi 10.3 Rio makes this an easy thing to overcome. Right click on the project in the project manager window and select “add platform”. Now choose “Windows 64bit”.

If you’re running a 64bit version of Windows you can go right ahead and select “build” and, if your components are 64bit compatible, you’ll end up with a pure 64bit exe. Simple as that.

If you’re using a 32 bit version of Windows you’ll need to connect to PAServer on a 64bit machine. To check your Windows version press the Windows key and ‘X’ and then select “system”. It will say “32 bit” or “64bit” like it does in the image at the top of this article.

But I should add a caveat; not all older components can work in a 64bit architecture. Encryption, for example, often is tied quite closely to the processor ‘bitness’. You may find that older code of this type either needs to be tweaked or replaced to work for 64bit Windows.

Likewise, some component vendors annotate their components to target only 32bit Windows, either due to the use of APIs which are incompatible with 64bit or due to other technical problems such as the size of integers and so on.

You can check if a particular component will work when targeting Windows 64bit by pointing your mouse at the component in the component palette in the RAD Studio / Delphi IDE. A hint window will appear listing all the target types on which the component can be used: Windows 32bit, Windows 64bit, iOS, Android, Linux, macOS and so on.

Here’s what the hint looks like (in dark mode) for a component which is only available for Windows 32 and 64bit.

You can read a more full explanation of targeting 64bit with Delphi here:

In the next article

We’re going to look at another silent feature of Windows 10 which will make your legacy programs look long in the tooth: high res DPI and the spectacularly-named “per monitor v2“. Come back tomorrow to see what it’s all about.

Leave a Reply

Your email address will not be published. Required fields are marked *