Kilho.net

Tag: Delphi

IT

Using Threads in Delphi

Here’s an easy way to use threads in Delphi. Just use synchronize properly 🙂 Function [code lang=”delphi”] uses System.Classes, System.SysUtils, Vcl.Forms; procedure Wait(Proc: TProc); var Thread: TThread; begin Thread := TThread.CreateAnonymousThread(procedure() begin Proc; end); Thread.FreeOnTerminate := True; Thread.Start; while not…

Read more — Using Threads in Delphi
IT

Registry Monitoring (Delphi)

How to Use procedure RegistryMonitor(RootKey: HKEY; Key: string; Proc: TProc; WatchSub: boolean); begin TThread.CreateAnonymousThread(procedure var Reg: TRegistry; Event: cardinal; begin Reg := TRegistry.Create; Reg.RootKey := RootKey; if Reg.OpenKeyReadOnly(Key) then begin Event := CreateEvent(nil, False, False, nil); if Event > 0…

Read more — Registry Monitoring (Delphi)