Kilho.net

Thẻ: Delphi

IT

Sử dụng thread trong Delphi

Cách sử dụng thread dễ dàng trong Delphi. Chỉ cần sử dụng synchronize đúng cách 🙂 Nội dung hàm [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 :=…

Xem thêm — Sử dụng thread trong Delphi
IT

Giám sát Registry (Delphi)

Cách sử dụng 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…

Xem thêm — Giám sát Registry (Delphi)