- Accessing Registry Keys and Items on Windows — TRegistry is a useful class can access Windows Registry which can check if the key exists or not, create a key, write a key, and etc.
- Adding a secret key in a program file — I had some projects needs to put its own secret key when they needed, and the secret key should not be exist as an alternative file or stored in any secret place in order to have mobility - meaning that application having a secret key should be able to use in any PC/Laptop. The easiest approach can do that is adding an additional information at the end of the binary file.
- Associate a Delphi application with a file extension — When user register a application by user choice, there are some registry entries automatically created by windows. By doing the same behaviors like windows, application can be launched automatically by clicking associated files.
- Capture Console Output To Memo in RealTime — The below code captures console outputs and send it in real time to callback function, so the application can handle it such as displaying its progress by adding to memo, so end user may not think the application is hanging while program performing the command.
- Combo box in readonly mode — Sometimes you may want to make user to select item on combo box without any editing permission. For your information, Combo Box is basically allowed user to edit its internal content.
- Downloading a web page as string from web site in Delphi — One of the easiest way can get web page as string is to use TIdHTTP.Get function.
- Enable internet proxy on windows by changing registry key — The code here simply set EnableProxy property to checked on Control Panel like below
- Encrypting a text string based on a key in Delphi — There are lots of way can encrypt a text string based on a key. By the approach, you can use a single numerical key, or text string. In terms of security's point of view, text string-based key has better security performance.
- Exec and Wait with new Thread
- Execute a Console Program and Capture Its Output
- ExtractFileExt — Delphi provides useful filename functions for file drive, file dir, file path, file name, and file ext.
- Find Files in Delphi — The custom procedure FindFiles locates files in a given directory (folder) and its subdirectories, and adds their complete path to a stringlist. Note that recursion is used: FindFiles calls itself at the end of the procedure!
- Get Current Directory
- Get local IP address in Delphi — Introducing three different approaches to get local IP address in Delphi: Winsock, TIdStack and TIdIPWatch.
- Get My Document Folder Location by TPath
- Get remote filename from URL in delphi — To get the filename from a URL, you can retrieve the HEAD information and check Content Disposition header field. For this task, you can use the TIdHTTP indy component. If the Content Disposition does not have the file name, you can try parsing the URL.
- Get Timezone Information in local machine in Delphi — GetTimeZoneInformation() enables you to get timezone information in standard name, standard bias, daylight name, and daylight bias.
- Get Windows Temp Directory — GetEnvironmentVariable() enables to get get environmental variables like TEMP.
- Get year, month, day from current date time — When getting system date time information, DecodeDate() is useful.
- Kill a process directly by program name — In order to terminate process on the current process list, you will need to refer Process Entry - by comparing process name and process entry, you can terminate it by comparing process name.
- Message Dialog in Delphi — MessageDlg() enables you to display system dialog based on various dialog type as well as system buttons,
- Put administrator permission to the Delphi application
- Read/Write data in Windows Registry — TRegistry enables you to read registry entry.
- RunAsAdminAndWaitForCompletion - replacement of ShellExecute
- Run as Administrator and Wait for Completion in Delphi — You may use ShellExecute to run DOS command in Delphi, but it causes lots of run-time error in Windows 10+ based on my experience, because system requires to have some sort of permission. Custom function RunAsAdminAndWaitForCompletion() will help you to clear that issue.
- Running with Delphi application with parameters — If you are considering taking parameters when starting your app, you can take it by ParamCount and ParamStr.
- Save/Load using file in Windows Registry — When application use a certain file, and there are some needs to use the previous file in many reason. In that case, Windows Registry is useful.
- Save Text in TStringList in UTF8 in Delphi — Delphi provides a straightforward way when saving text in TStringList in Unicode. Please see following example.
- Select Directory in Delphi — Below code is an example to select directory by TFileOpenDialog:
- Simple function can select directory in Delphi — Instead of using TOpenDialog, Delphi provides super simple function can select directory as following:
- Simple Thread Example in Delphi
- String replace by regular expression in Delphi — TRegEx is a useful class for regular expression. You can define a instance with a regular expression, and match the case by TMatch. If the case exists, the search can be continued by TMatch.NextMatch.
- StringReplace in Delphi — Delphi provides a straight forward function can replace string - StringReplace
- Update domain name at DNSZI in Delphi — To update IP address at DNSZI(http://dnszi.com) http://dnszi.com), you need user ID, auth key, your domain name, and its hostname.
Overview
Content Tools