Kilho.net

Tag: Delphi

IT

Uso dei thread in Delphi

Ecco un modo semplice per usare i thread in Delphi. synchronize va usato con criterio 🙂 Contenuto della funzione [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 :=…

Leggi tutto — Uso dei thread in Delphi
IT

Monitoraggio del registro (Delphi)

Modalità d’uso 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 then…

Leggi tutto — Monitoraggio del registro (Delphi)