unit DInstMonMain; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, ThdInstMon, Vcl.StdCtrls, Vcl.ExtCtrls; type TDlgInstMon = class(TForm) btnDetectInst: TButton; tInit: TTimer; procedure btnDetectInstClick(Sender: TObject); procedure tInitTimer(Sender: TObject); private { Private declarations } ThdInstMon_: TThdInstMon; public { Public declarations } Constructor Create(aOwner: TComponent); override; Destructor Destroy; override; procedure process_WM_INST_NOTIFY(var msg: TMessage); Message WM_INST_NOTIFY; end; var DlgInstMon: TDlgInstMon; implementation uses // System.Net.HttpClient, Define, superobject, GlobalDefine, DNotice; {$R *.dfm} Constructor TDlgInstMon.Create(aOwner: TComponent); begin Inherited Create(aOwner); Caption := APP_TITLE; ThdInstMon_ := nil; tInit.Enabled := true; end; Destructor TDlgInstMon.Destroy; begin if ThdInstMon_ <> nil then FreeAndNil(ThdInstMon_); Inherited; end; procedure TDlgInstMon.btnDetectInstClick(Sender: TObject); //var // LHTTP: THTTPClient; begin // LHTTP := THTTPClient.Create; // LHTTP.UserAgent if ThdInstMon_ = nil then begin ThdInstMon_ := TThdInstMon.Create(Handle); ThdInstMon_.StartService; MessageBox(Handle, PChar('"ÇÁ·Î±×·¥ ¼³Ä¡ °¨Áö ÈÄ »èÁ¦"°¡ ½ÃÀÛ µÇ¾ú½À´Ï´Ù.'), APP_TITLE, MB_ICONINFORMATION or MB_OK); btnDetectInst.Caption := 'ÇÁ·Î±×·¥ ¼³Ä¡ °¨Áö ÈÄ »èÁ¦ ÁßÁö'; end else begin FreeAndNil(ThdInstMon_); MessageBox(Handle, PChar('"ÇÁ·Î±×·¥ ¼³Ä¡ °¨Áö ÈÄ »èÁ¦"°¡ ÁßÁö µÇ¾ú½À´Ï´Ù.'), APP_TITLE, MB_ICONINFORMATION or MB_OK); btnDetectInst.Caption := 'ÇÁ·Î±×·¥ ¼³Ä¡ °¨Áö ÈÄ »èÁ¦ ½ÃÀÛ'; end; end; procedure TDlgInstMon.process_WM_INST_NOTIFY(var msg: TMessage); var O: ISuperObject; begin O := SO; O.I['T'] := TYPE_MSG_PREVENT_INSTALL; O.S['D'] := String(msg.LParam); TDlgNotice.Create(nil).PopupMessage(O.AsString); end; procedure TDlgInstMon.tInitTimer(Sender: TObject); begin tInit.Enabled := false; // btnDetectInst.Click; end; end.