Tag - Delphi

Registry Monitoring (Delphi)

How to use Procedure RegistryMonitor (Rootkey: hKey; Key: String; Proc: Tproc; WatchSub: boolean); begin TTHREAD.CREATEANYNYMOUSTHREAD (Procedure var Reg: Tregistry; Event: Cardinal; begin Reg: = trrewistry.create; Reg.rootkey: = rootKey; if reg.openkeyreadonly (key) begin Event: = Createevent (NIL, FALSE, FALSE, NIL); if event> 0 then begin while true do begin RegNotifychandureKeyvalue (reg.currentkey, watchsub, reg_notify_Change_last_set, event, true); if waitForsingleObject (event, infinite) = wait_object_0 the tthread.synchronize (TTHREAD.CURENTHREAD, Procedure Begin Proc End); End; End; End; Reg.Free; end) .start; End; // Proc: Enter command // WatchSub: Subside monitoring ...