BSOne.SFC/Tocsg.Module/InstMon/DInstMonMain.pas

90 lines
2.1 KiB
Plaintext

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.