How to Access the Registry Using Windows API

Posted December 15th @ 8:55 pm by m3Rlin

You may, for some reasons not want to use Delphi’s TRegistry component but still want to use the system’s Registry. This may come in handy when creating applications for Windows NT/2000/XP/Vista. Delphi’s TRegistry component will raise an error when attempting to write a string value to the HKEY_LOCAL_MACHINE key. Well, the way to get over [...]

How to Get the Windows System Directory

Posted December 15th @ 6:56 pm by m3Rlin

To found out the name of the Windows directory it’s best to use the Windows API GetSystemDirectory() function.
Here’s the Delphi implementation:

uses Windows;

function GetSystemDir: string;
const
(* The length of the directory buffer. Usually 64 or even 16 is enough
**
** Must be DWORD type.
*)
dwLength: DWORD = 255;
var
psSysDir: PChar;
begin
GetMem(psSysDir, dwLength);
GetSystemDirectory(psSysDir, [...]

« Previous Entries