Home Categories Example Code
Category
Cancel

Example Code 19

Preview Image

Use CreateProcess and capture the output in Windows

It is highly likely that most Delphi programmers already have some code in the toolbox for launching applications on Windows. I know that I have written a few different utility functions myself ove...

Preview Image

Simple Code Profiling In Delphi

I imagine most Delphi developers have written code similar to the following to quickly test a block of code using the Now function: procedure TDemoExecutionProfilerForm.DoSomeComplexCode; var St...

Preview Image

RADAuthenticator Part 5 - Implement a "Hello World" GitHub Action on your self-hosted runner

GitHub Actions is a powerful automation tool first introduced by GitHub back in 2018 and has significantly matured over the last few years. It can be leveraged to automate workflows based on even...

Preview Image

How to enable DEP and ASLR to reduce the attack vector of your Delphi applications on Windows

TLDR; for 32-bit applications add this line to your DPR: {$SETPEOPTFLAGS $140} for 64-bit applications use: {$SETPEOPTFLAGS $160} {$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE} or, if you do no...

Preview Image

How to access private fields with RTTI to give TRESTClient an OnReceiveData event

I was speaking with a colleague the other day who was working on a project which relied on the popular Delphi component trio: TRESTClient, TRESTRequest and TRESTResponse. He wanted to add a progres...

Preview Image

RADAuthenticator Part 2 - Generate one time password tokens in Delphi using TOTP

In part one of this blog post series on an upcoming multi-platform RADAuthenticator Delphi app, we went over base32 encoding which is used for managing the secret key in Google Authenticator compat...

Preview Image

Base32 encoding in Delphi for an upcoming Google Authenticator replacement app - part 1 of series.

Programmers can be an odd lot - we can have a perfectly good tool available to us and we still yearn to build our own version of it. In this case, Google Authenticator was released back in 2010 and...

Preview Image

Unit Testing FizzBuzz in Delphi

In the last article, a simple solution to the common FizzBuzz software developer interview screening test was discussed. For the majority of employers, the simple solution provided will likely be a...

Preview Image

Developer interview questions: FizzBuzz in Delphi

A lot of time, effort, and money is invested into hiring developers so businesses typically go out of their way to ensure they have a qualified candidate. As I’ve experienced a few times over the y...

Preview Image

Utility class for activating external VCL Style files in Delphi

The VCL Styles feature in Delphi has seen major improvements as of late, including High DPI and 4K monitors in RAD Studio 10.4 Sydney. It seems like a rather niche feature for many Delphi developer...

Preview Image

Test driving Delphi's TCountdownEvent

In this post, we take a look at TCountdownEvent from the System.SyncObjs.pas unit, first introduced back in Delphi XE. To be honest, I haven’t used this class before. It’s a shame too, as it seems ...

Preview Image

Newly discovered hidden benefits of inline variables in Delphi

To be honest, I have always regarded the new inline variables in Delphi 10.3 feature as something that I would never use, except perhaps variable initialization as that is obviously a very cool t...

Preview Image

Revisiting TThreadedQueue and TMonitor in Delphi

Unfortunately, both TThreadedQueue and TMonitor have a tainted history in Delphi. The original release of TThreadedQueue looked promising, with Mason Wheeler even classifying the new feature in Del...

Preview Image

Name your threads, even the ones auto-created by Delphi

I haven’t heard of too many Delphi developers that insist on naming all threads created in an application, but I think it is good practice. Call me overly pedantic if you must, but the practice cer...

Preview Image

Custom File Dialogs in Delphi via IFileDialogCustomize

While today’s programmers are typically excited about new browser-based technology, the old school Component Object Model (COM) in Windows is still leveraged by a very large portion of business sof...

Preview Image

Delphi JavaScript execution - ditch TWebBrowser for ChakraCore

I assume a large portion of the Delphi developer community has leveraged TWebBrowser to some degree over the years - I know I have used it many times. So, when I started a new project and wanted to...

Preview Image

Writing Cross Framework code in Delphi

Sharing Delphi code between your FMX and VCL applications is pretty easy for non-visual functionality, with the exception of zero-based strings (and ARC on mobile platforms which is being rolled ba...

Preview Image

libcurl and Delphi

libcurl is a hugely popular tool, available on most platforms and supports many internet protocols. I’ve mainly used it for HTTP GET/POST tasks but there’s built-in support for FTP, IMAP, POP3, SMT...

Preview Image

DLL Injection with Delphi

I had recently spent some time playing around with the simple to use DelphiDetours package from Mahdi Safsafi https://github.com/MahdiSafsafi/DDetours One missing feature is the ability to inject...