781 lines
22 KiB
Plaintext
781 lines
22 KiB
Plaintext
unit DeCrmHeMainOld;
|
||
|
||
interface
|
||
|
||
uses
|
||
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
|
||
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.Imaging.pngimage,
|
||
PngImageList, System.ImageList, Vcl.ImgList, Vcl.Buttons, Vcl.StdCtrls,
|
||
Vcl.Menus, ManagerService, WindowAnimator;
|
||
|
||
const
|
||
SIZE_EXTEND_FORM = 300;
|
||
|
||
type
|
||
TDlgeCrmHeMainOld = class(TForm)
|
||
pnMain: TPanel;
|
||
imgMain: TImage;
|
||
imgClose: TImage;
|
||
imgMini: TImage;
|
||
imgQA: TImage;
|
||
Label1: TLabel;
|
||
Label2: TLabel;
|
||
lbVer: TLabel;
|
||
Label3: TLabel;
|
||
Label4: TLabel;
|
||
Label5: TLabel;
|
||
Label6: TLabel;
|
||
Label7: TLabel;
|
||
Label8: TLabel;
|
||
Label9: TLabel;
|
||
Label10: TLabel;
|
||
Label11: TLabel;
|
||
Label12: TLabel;
|
||
imgSetOs: TImage;
|
||
imgSetAccPass: TImage;
|
||
imgSetScreenSaver: TImage;
|
||
imgSetAntiVirus: TImage;
|
||
imgSetFW: TImage;
|
||
imgAntiVirusInfo: TImage;
|
||
imgFwInfo: TImage;
|
||
SpeedButton1: TSpeedButton;
|
||
SpeedButton2: TSpeedButton;
|
||
SpeedButton3: TSpeedButton;
|
||
lbEmpNo: TLabel;
|
||
lbIpInfo: TLabel;
|
||
lbOS: TLabel;
|
||
lbAV: TLabel;
|
||
lbFW: TLabel;
|
||
lbConn: TLabel;
|
||
lbFileProtec: TLabel;
|
||
lbMonPrint: TLabel;
|
||
imgPassSet: TImage;
|
||
imgScreenSet: TImage;
|
||
imgUSB: TImage;
|
||
imgSoft: TImage;
|
||
SpeedButton4: TSpeedButton;
|
||
imgMainList: TPngImageCollection;
|
||
imgUpBtnList: TPngImageList;
|
||
imgEvList: TPngImageList;
|
||
imgSetList: TPngImageList;
|
||
popTray: TPopupMenu;
|
||
miAgentState: TMenuItem;
|
||
miDelAgent: TMenuItem;
|
||
TrayIcon: TTrayIcon;
|
||
imgOXList: TPngImageList;
|
||
btnExtendLeft: TSpeedButton;
|
||
btnExtendRight: TSpeedButton;
|
||
imgArrow: TPngImageList;
|
||
tMtx: TTimer;
|
||
tInit: TTimer;
|
||
lbSoftCtrl: TLabel;
|
||
procedure imgMainMouseDown(Sender: TObject; Button: TMouseButton;
|
||
Shift: TShiftState; X, Y: Integer);
|
||
procedure imgCloseClick(Sender: TObject);
|
||
procedure imgCloseMouseEnter(Sender: TObject);
|
||
procedure imgCloseMouseLeave(Sender: TObject);
|
||
procedure imgQAMouseEnter(Sender: TObject);
|
||
procedure imgQAMouseLeave(Sender: TObject);
|
||
procedure imgMiniClick(Sender: TObject);
|
||
procedure imgSetOsMouseEnter(Sender: TObject);
|
||
procedure imgSetOsMouseLeave(Sender: TObject);
|
||
procedure SpeedButton1Click(Sender: TObject);
|
||
procedure SpeedButton2Click(Sender: TObject);
|
||
procedure SpeedButton3Click(Sender: TObject);
|
||
procedure imgSetOsClick(Sender: TObject);
|
||
procedure imgSetScreenSaverClick(Sender: TObject);
|
||
procedure imgSetAntiVirusClick(Sender: TObject);
|
||
procedure imgSetFWClick(Sender: TObject);
|
||
procedure imgSetAccPassClick(Sender: TObject);
|
||
procedure imgAntiVirusInfoClick(Sender: TObject);
|
||
procedure imgFwInfoClick(Sender: TObject);
|
||
procedure SpeedButton4Click(Sender: TObject);
|
||
procedure imgQAClick(Sender: TObject);
|
||
procedure btnExtendRightClick(Sender: TObject);
|
||
procedure btnExtendLeftClick(Sender: TObject);
|
||
procedure miAgentStateClick(Sender: TObject);
|
||
procedure tMtxTimer(Sender: TObject);
|
||
procedure tInitTimer(Sender: TObject);
|
||
procedure miDelAgentClick(Sender: TObject);
|
||
procedure popTrayPopup(Sender: TObject);
|
||
procedure lbIpInfoDblClick(Sender: TObject);
|
||
procedure lbEmpNoDblClick(Sender: TObject);
|
||
private
|
||
{ Private declarations }
|
||
dtStartTick_: DWORD; // <20><><EFBFBD><EFBFBD> <20><> Ʈ<><C6AE><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>˾<EFBFBD><CBBE>̵Ǹ<CCB5> Ʈ<><C6AE><EFBFBD>̰<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. üũ<C3BC>ϱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20>߰<EFBFBD> 22_0511 16:22:43 kku
|
||
LastWS_: TWindowState;
|
||
MgSvc_: TManagerService;
|
||
// WndAni_: TWindowAnimator;
|
||
// bWndExpend_: Boolean;
|
||
procedure SetImgBtn(aImgList: TPngImageList; imgBtn: TImage; nImgIdx: Integer);
|
||
procedure SetPosiNegaImg(img: TImage; bPosi: Boolean);
|
||
// procedure UpdateVisibleExtendArrow;
|
||
// procedure FinishWindowExpend;
|
||
procedure RefreshView;
|
||
procedure VisibleMainform(bVal: Boolean);
|
||
public
|
||
{ Public declarations }
|
||
Constructor Create(aOwner: TComponent); override;
|
||
procedure CreateParams(var Params: TCreateParams); override;
|
||
Destructor Destroy; override;
|
||
|
||
procedure process_WM_POPUP_MSG(var msg: TMessage); Message WM_POPUP_MSG;
|
||
procedure process_WM_POPUP_LICENSE(var msg: TMessage); Message WM_POPUP_LICENSE;
|
||
procedure process_WM_POPUP_MSG_SYSTEM(var msg: TMessage); Message WM_POPUP_MSG_SYSTEM;
|
||
procedure process_WM_REFRESH_VIEW(var msg: TMessage); Message WM_REFRESH_VIEW;
|
||
procedure process_WM_SYSCOMMAND(var msg: TWMSysCommand); Message WM_SYSCOMMAND;
|
||
// procedure process_WM_WINDOWPOSCHANGED(var msg: TMessage); Message WM_WINDOWPOSCHANGED;
|
||
end;
|
||
|
||
var
|
||
DlgeCrmHeMainOld: TDlgeCrmHeMainOld;
|
||
|
||
implementation
|
||
|
||
uses
|
||
Define, Tocsg.Strings, Tocsg.Trace, Tocsg.Process, Condition, Tocsg.Shell,
|
||
DNotice, Tocsg.Safe, License, DLicense, DQnA, DLiteInfo, Tocsg.Win32,
|
||
GlobalDefine, Tocsg.Service, Tocsg.Path, Winapi.WinSvc, superobject,
|
||
ProcessParam, Tocsg.Convert;
|
||
|
||
resourcestring
|
||
RS_LatestApplied = '<27>ֽ<EFBFBD> <20><><EFBFBD><EFBFBD>';
|
||
RS_ActionRequired = '<27><>ġ <20>ʿ<EFBFBD>';
|
||
|
||
{$R *.dfm}
|
||
|
||
Constructor TDlgeCrmHeMainOld.Create(aOwner: TComponent);
|
||
|
||
procedure InitCtrls;
|
||
begin
|
||
LastWS_ := wsNormal;
|
||
// WndAni_ := TWindowAnimator.Create(Self);
|
||
// WndAni_.Duration := 300;
|
||
// bWndExpend_ := false;
|
||
// {$IFNDEF DEBUG}
|
||
SpeedButton1.Visible := false;
|
||
SpeedButton2.Visible := false;
|
||
SpeedButton3.Visible := false;
|
||
SpeedButton4.Visible := false;
|
||
// {$ENDIF}
|
||
|
||
SetImgBtn(imgUpBtnList, imgMini, imgMini.Tag);
|
||
SetImgBtn(imgUpBtnList, imgClose, imgClose.Tag);
|
||
SetImgBtn(imgUpBtnList, imgAntiVirusInfo, imgAntiVirusInfo.Tag);
|
||
SetImgBtn(imgUpBtnList, imgFwInfo, imgFwInfo.Tag);
|
||
SetImgBtn(imgEvList, imgQA, imgQA.Tag);
|
||
SetImgBtn(imgSetList, imgSetOs, imgSetOs.Tag);
|
||
SetImgBtn(imgSetList, imgSetAccPass, imgSetAccPass.Tag);
|
||
SetImgBtn(imgSetList, imgSetScreenSaver, imgSetScreenSaver.Tag);
|
||
SetImgBtn(imgSetList, imgSetAntiVirus, imgSetAntiVirus.Tag);
|
||
SetImgBtn(imgSetList, imgSetFW, imgSetFW.Tag);
|
||
lbVer.Caption := 'Tocsg Provided';
|
||
|
||
dtStartTick_ := GetTickCount;
|
||
|
||
{$IFNDEF DEBUG}
|
||
tMtx.Enabled := true;
|
||
{$ENDIF}
|
||
tInit.Enabled := true;
|
||
end;
|
||
|
||
begin
|
||
Inherited Create(aOwner);
|
||
|
||
Caption := APP_TITLE;
|
||
{$IFDEF DEBUG}
|
||
// <20><EFBFBD>Ʈ <20><><EFBFBD>ع<EFBFBD>? <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
TerminateProcessByName('eCrmHeService.exe');
|
||
TerminateProcessByName('eCrmHomeEdition.exe', GetCurrentProcessId);
|
||
if TerminateProcessByName('javaw.exe') then
|
||
Sleep(1000);
|
||
{$ENDIF}
|
||
|
||
MgSvc_ := nil;
|
||
// MgSvc_ := TManagerService.Create(Handle);
|
||
// if GetProcessPidByName(EXE_MG) <> 0 then
|
||
// MgSvc_.ActiveThdreadProcess := true;
|
||
|
||
InitCtrls;
|
||
// RefreshView;
|
||
// UpdateVisibleExtendArrow;
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.CreateParams(var Params: TCreateParams);
|
||
begin
|
||
inherited CreateParams( Params );
|
||
Params.ExStyle := WS_EX_APPWINDOW;
|
||
Params.WindowClass.Style := Params.WindowClass.Style or CS_DROPSHADOW;
|
||
end;
|
||
|
||
Destructor TDlgeCrmHeMainOld.Destroy;
|
||
begin
|
||
tMtx.Enabled := false;
|
||
if MgSvc_ <> nil then
|
||
FreeAndNil(MgSvc_);
|
||
Inherited;
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.VisibleMainform(bVal: Boolean);
|
||
var
|
||
OldFormStyle: TFormStyle;
|
||
begin
|
||
if bVal then
|
||
begin
|
||
WindowState := LastWS_;
|
||
Show;
|
||
OldFormStyle := FormStyle;
|
||
FormStyle := fsStayOnTop;
|
||
FormStyle := OldFormStyle;
|
||
SetForegroundWindow(Handle);
|
||
dtStartTick_ := 0;
|
||
end else begin
|
||
LastWS_ := WindowState;
|
||
WindowState := wsMinimized;
|
||
Hide;
|
||
end;
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.btnExtendLeftClick(Sender: TObject);
|
||
begin
|
||
// pnMain.Anchors := pnMain.Anchors - [akLeft];
|
||
// pnMain.Anchors := pnMain.Anchors + [akRight];
|
||
// if not bWndExpend_ then
|
||
// begin
|
||
// bWndExpend_ := true;
|
||
// WndAni_.AnimateWidthLeft(Width + SIZE_EXTEND_FORM);
|
||
// btnExtendLeft.ImageIndex := 1;
|
||
// end else begin
|
||
// WndAni_.AnimateWidthLeft(Width - SIZE_EXTEND_FORM, nil, FinishWindowExpend);
|
||
// btnExtendLeft.ImageIndex := 0;
|
||
//// bWndExpend_ := false;
|
||
// end;
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.btnExtendRightClick(Sender: TObject);
|
||
begin
|
||
// pnMain.Anchors := pnMain.Anchors + [akLeft];
|
||
// pnMain.Anchors := pnMain.Anchors - [akRight];
|
||
// if not bWndExpend_ then
|
||
// begin
|
||
// bWndExpend_ := true;
|
||
// WndAni_.AnimateWidth(Width + SIZE_EXTEND_FORM);
|
||
// btnExtendRight.ImageIndex := 0;
|
||
// end else begin
|
||
// WndAni_.AnimateWidth(Width - SIZE_EXTEND_FORM, nil, FinishWindowExpend);
|
||
// btnExtendRight.ImageIndex := 1;
|
||
//// bWndExpend_ := false;
|
||
// end;
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.RefreshView;
|
||
var
|
||
sTemp: String;
|
||
begin
|
||
if Application.Terminated then
|
||
exit;
|
||
|
||
if MgSvc_ = nil then
|
||
exit;
|
||
|
||
with MgSvc_.VulService do
|
||
begin
|
||
if (AvInfo = nil) or (AvInfo.Name = '') then
|
||
begin
|
||
// bad
|
||
imgMain.Picture.Assign(imgMainList.Items[2].PngImage);
|
||
end else begin
|
||
if MgSvc_.IsServiceAvailable then
|
||
begin
|
||
if IsSafeMode then
|
||
imgMain.Picture.Assign(imgMainList.Items[1].PngImage) // good
|
||
else
|
||
imgMain.Picture.Assign(imgMainList.Items[2].PngImage); // bad
|
||
lbIpInfo.Caption := MgSvc_.NicService.GetIP;
|
||
end else begin
|
||
imgMain.Picture.Assign(imgMainList.Items[0].PngImage); // sleep
|
||
lbIpInfo.Caption := '<27><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>';
|
||
end;
|
||
end;
|
||
|
||
if CUSTOMER_TYPE = CUSTOMER_METLIFE then
|
||
begin
|
||
// <20>ΰ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
end;
|
||
|
||
sTemp := MgSvc_.AgentModel.EmpNo;
|
||
if sTemp = '' then
|
||
begin
|
||
sTemp := WindowsAccount;
|
||
lbEmpNo.Font.Style := lbEmpNo.Font.Style + [fsBold];
|
||
end else
|
||
lbEmpNo.Font.Style := lbEmpNo.Font.Style - [fsBold];
|
||
lbEmpNo.Caption := Format('%s (%s)', [sTemp,
|
||
BooleanToStr(MgSvc_.AgentModel.Location = '', 'Unknown', MgSvc_.AgentModel.Location)]);
|
||
|
||
lbOS.Caption := 'MS Windows ' + OsVersion;
|
||
if IsOsPatchUptoDate and IsOsSafe then
|
||
begin
|
||
lbOS.Caption := Format('MS Windows %s (%s)', [OsVersion, RS_LatestApplied]);
|
||
lbOS.Font.Color := Label3.Font.Color;
|
||
end else begin
|
||
lbOS.Caption := Format('MS Windows %s (%s)', [OsVersion, RS_ActionRequired]);
|
||
lbOS.Font.Color := clRed;
|
||
end;
|
||
|
||
SetPosiNegaImg(imgPassSet, IsPasswordSet);
|
||
SetPosiNegaImg(imgScreenSet, IsScreenSaverSet);
|
||
|
||
if AvInfo <> nil then
|
||
begin
|
||
if IsAntiVirusUpToDate then
|
||
begin
|
||
lbAV.Caption := Format('%s (%s)', [AvInfo.Name, RS_LatestApplied]);
|
||
lbAV.Font.Color := Label3.Font.Color;
|
||
end else begin
|
||
lbAV.Caption := Format('%s (%s)', [AvInfo.Name, RS_ActionRequired]);
|
||
lbAV.Font.Color := clRed;
|
||
end;
|
||
end else
|
||
lbAV.Caption := '';
|
||
|
||
if FwInfo <> nil then
|
||
begin
|
||
if IsFirewallOn and FwInfo.IsState then
|
||
begin
|
||
lbFW.Caption := Format('%s (%s)', [FwInfo.Name, RS_LatestApplied]);
|
||
lbFW.Font.Color := Label3.Font.Color;
|
||
end else begin
|
||
lbFW.Caption := Format('%s (%s)', [FwInfo.Name, RS_ActionRequired]);
|
||
lbFW.Font.Color := clRed;
|
||
end;
|
||
end else
|
||
lbFW.Caption := '';
|
||
|
||
lbConn.Caption := AccessStatus;
|
||
|
||
sTemp := '';
|
||
if MgSvc_.PrefModel.IsMasking then
|
||
sTemp := '<27><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ŷ'
|
||
else if MgSvc_.PrefModel.IsPreventFileSaving then
|
||
sTemp := '<27><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>'
|
||
else if MgSvc_.PrefModel.IsFileMonitor then
|
||
sTemp := '<27><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>';
|
||
|
||
if MgSvc_.PrefModel.IsWaterMark then
|
||
SumString(sTemp, '<27><><EFBFBD><EFBFBD> <20>̹<EFBFBD><CCB9><EFBFBD> <20><><EFBFBD><EFBFBD>ŷ', ' && ');
|
||
lbFileProtec.Caption := sTemp;
|
||
|
||
sTemp := '';
|
||
if MgSvc_.PrefModel.IsPrinterEnable then
|
||
sTemp := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>';
|
||
if MgSvc_.PrefModel.IsLogoDisplay then
|
||
SumString(sTemp, 'ȭ<><C8AD> <20><><EFBFBD>÷ΰ<C3B7>', ' && ');
|
||
lbMonPrint.Caption := sTemp;
|
||
|
||
SetPosiNegaImg(imgUSB, MgSvc_.PrefModel.UsbEnable);
|
||
|
||
if (MgSvc_.PrefModel.SoftwareControlType = '') or
|
||
(MgSvc_.PrefModel.SoftwareControlType.ToLower = 'false') then
|
||
begin
|
||
SetPosiNegaImg(imgSoft, false);
|
||
lbSoftCtrl.Visible := false;
|
||
imgSoft.Visible := true;
|
||
end else begin
|
||
imgSoft.Visible := false;
|
||
lbSoftCtrl.Caption := MgSvc_.PrefModel.SoftwareControlType;
|
||
lbSoftCtrl.Visible := true;
|
||
end;
|
||
|
||
if MgSvc_.IsConnStatus then
|
||
begin
|
||
lbVer.Caption := ' (Manage Mode) @Tocsg Provided';
|
||
lbVer.Font.Color := clBlue;
|
||
end else
|
||
begin
|
||
lbVer.Caption := ' (Standalone Mode) @Tocsg Provided';
|
||
lbVer.Font.Color := clGreen;
|
||
end;
|
||
lbVer.Caption := SdkVersion + lbVer.Caption;
|
||
end;
|
||
Application.ProcessMessages;
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.SetImgBtn(aImgList: TPngImageList; imgBtn: TImage; nImgIdx: Integer);
|
||
begin
|
||
aImgList.GetIcon(nImgIdx, imgBtn.Picture.Icon);
|
||
imgBtn.Repaint
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.SetPosiNegaImg(img: TImage; bPosi: Boolean);
|
||
var
|
||
nIdx: Integer;
|
||
begin
|
||
if bPosi then
|
||
nIdx := 0
|
||
else
|
||
nIdx := 1;
|
||
|
||
imgOXList.GetIcon(nIdx, img.Picture.Icon);
|
||
end;
|
||
|
||
//procedure TDlgeCrmHeMain.UpdateVisibleExtendArrow;
|
||
//begin
|
||
// if not bWndExpend_ then
|
||
// begin
|
||
// btnExtendLeft.Visible := (Left + Width + SIZE_EXTEND_FORM) > Screen.PrimaryMonitor.Width;
|
||
// btnExtendRight.Visible := not btnExtendLeft.Visible;
|
||
// end;
|
||
//end;
|
||
|
||
//procedure TDlgeCrmHeMain.FinishWindowExpend;
|
||
//begin
|
||
// bWndExpend_ := not bWndExpend_;
|
||
//end;
|
||
|
||
procedure TDlgeCrmHeMainOld.SpeedButton1Click(Sender: TObject);
|
||
begin
|
||
imgMain.Picture.Assign(imgMainList.Items[0].PngImage);
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.SpeedButton2Click(Sender: TObject);
|
||
begin
|
||
imgMain.Picture.Assign(imgMainList.Items[1].PngImage);
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.SpeedButton3Click(Sender: TObject);
|
||
begin
|
||
imgMain.Picture.Assign(imgMainList.Items[2].PngImage);
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.SpeedButton4Click(Sender: TObject);
|
||
var
|
||
dlg: TDlgNotice;
|
||
begin
|
||
dlg := TDlgNotice.Create(Self);
|
||
dlg.Show;
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.tInitTimer(Sender: TObject);
|
||
begin
|
||
tInit.Enabled := false;
|
||
MgSvc_ := TManagerService.Create(Handle);
|
||
if GetProcessPidByName(EXE_MG) <> 0 then
|
||
MgSvc_.ActiveThdreadProcess := true;
|
||
|
||
TrayIcon.Visible := true;
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.tMtxTimer(Sender: TObject);
|
||
begin
|
||
if MutexExists(MUTEX_KILL) then
|
||
begin
|
||
TrayIcon.Visible := false;
|
||
TerminateProcess(GetCurrentProcess, 99);
|
||
end;
|
||
|
||
// <20><><EFBFBD><EFBFBD> DLL<4C><4C> <20><><EFBFBD><EFBFBD> <20><> <20>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> 22_0511 13:45:23 kku
|
||
// if not MutexExists(MUTEX_SERVICE) then
|
||
// begin
|
||
// SetVisibleServce(NAME_SERVICE, true);
|
||
//
|
||
// if not ServiceExists(NAME_SERVICE) then
|
||
// begin
|
||
// var sSvcPath: String := GetSystemDir + EXE_SV;
|
||
// if FileExists(sSvcPath) then
|
||
// begin
|
||
// InstallService(NAME_SERVICE, sSvcPath, NAME_SERVICE,
|
||
// SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START);
|
||
// end;
|
||
// end;
|
||
//
|
||
// case GetServiceStatus(NAME_SERVICE) of
|
||
// 0, SERVICE_RUNNING,
|
||
// SERVICE_START_PENDING : ;
|
||
// else begin
|
||
// ServiceStart(NAME_SERVICE);
|
||
// SetVisibleServce(NAME_SERVICE, false);
|
||
// end;
|
||
// end;
|
||
// end;
|
||
|
||
if GetProcessPidByName(EXE_MG) = 0 then
|
||
begin
|
||
MgSvc_.ActiveThdreadProcess := false;
|
||
var sMgPath: String := GetRunExePathDir + 'conf\' + EXE_MG;
|
||
if FileExists(sMgPath) then
|
||
begin
|
||
// ExecutePath(sMgPath);
|
||
ExecuteApp(sMgPath, '', SW_SHOWNORMAL);
|
||
Sleep(1000);
|
||
MgSvc_.ActiveThdreadProcess := true;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.imgQAClick(Sender: TObject);
|
||
var
|
||
dlg: TDlgQnA;
|
||
begin
|
||
Guard(dlg, TDlgQnA.Create(Self));
|
||
if dlg.ShowModal = mrOk then
|
||
MgSvc_.SendEventLog(URI_USER_ACTION, LOGCODE_EVENT_QNA, dlg.mmQnA.Text);
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.imgQAMouseEnter(Sender: TObject);
|
||
begin
|
||
if Sender is TImage then
|
||
SetImgBtn(imgEvList, imgQA, imgQA.Tag + 1);
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.imgQAMouseLeave(Sender: TObject);
|
||
begin
|
||
if Sender is TImage then
|
||
SetImgBtn(imgEvList, imgQA, imgQA.Tag);
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.imgSetAccPassClick(Sender: TObject);
|
||
begin
|
||
ExecutePath_hide('cmd.exe', PARAM_GO_SETPASS);
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.imgSetAntiVirusClick(Sender: TObject);
|
||
begin
|
||
ExecutePath_hide('cmd.exe', PARAM_GO_ANTIVIRUS);
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.imgSetFWClick(Sender: TObject);
|
||
begin
|
||
ExecutePath_hide('cmd.exe', PARAM_GO_FIREWALL);
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.imgSetOsClick(Sender: TObject);
|
||
begin
|
||
ExecutePath_hide('cmd.exe', PARAM_GO_WINUPDATE);
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.imgSetOsMouseEnter(Sender: TObject);
|
||
begin
|
||
if Sender is TImage then
|
||
SetImgBtn(imgSetList, TImage(Sender), TImage(Sender).Tag + 1);
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.imgSetOsMouseLeave(Sender: TObject);
|
||
begin
|
||
if Sender is TImage then
|
||
SetImgBtn(imgSetList, TImage(Sender), TImage(Sender).Tag);
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.imgSetScreenSaverClick(Sender: TObject);
|
||
begin
|
||
ExecutePath_hide('cmd.exe', PARAM_GO_SETSAVER);
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.lbEmpNoDblClick(Sender: TObject);
|
||
begin
|
||
ShowMessage(MgSvc_.VulService.WindowsAccount);
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.lbIpInfoDblClick(Sender: TObject);
|
||
begin
|
||
ShowMessage(MgSvc_.VpnClient);
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.miAgentStateClick(Sender: TObject);
|
||
begin
|
||
VisibleMainform(true);
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.miDelAgentClick(Sender: TObject);
|
||
var
|
||
sDstDir,
|
||
sCurPath: String;
|
||
O: ISuperObject;
|
||
begin
|
||
if MessageBox(Handle, PChar('[<5B><>]<5D><> <20><><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD>, eCRM Home Edition<6F><6E> <20><><EFBFBD><EFBFBD><EFBFBD>˴ϴ<CBB4>.'+#13+#10+
|
||
'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ұ<EFBFBD><D2B0><EFBFBD><EFBFBD>ϸ<EFBFBD> <20><><EFBFBD>ñٹ<C3B1><D9B9><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ӿ<EFBFBD> ġ<><C4A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+#13+#10+
|
||
'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>߱<EFBFBD><DFB1><EFBFBD> <20><> <20>ֽ<EFBFBD><D6BD>ϴ<EFBFBD>.'+#13+#10+
|
||
'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͻðڽ<C3B0><DABD>ϱ<EFBFBD>?'), APP_TITLE, MB_ICONWARNING or MB_YESNO) = IDNO then exit;
|
||
sCurPath := GetRunExePath;
|
||
sDstDir := ExtractFilePath(ExcludeTrailingPathDelimiter(ExtractFilePath(sCurPath))) + ExtractFileName(sCurPath);
|
||
if CopyFile(PChar(sCurPath), PChar(sDstDir), false) then
|
||
begin
|
||
Sleep(1000);
|
||
O := SO;
|
||
O.I['M'] := MODE_DELETE;
|
||
O.S['ID'] := ExtractFilePath(sCurPath);
|
||
O.B['SD'] := true;
|
||
sCurPath := GetRunExePathDir + 'reqprm.json';
|
||
if SaveJsonObjToFile(O, sCurPath) then
|
||
ExecutePath_hide(sDstDir, Format('-i "%s"', [sCurPath]))
|
||
else
|
||
DeleteFile(sDstDir);
|
||
end;
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.imgAntiVirusInfoClick(Sender: TObject);
|
||
var
|
||
StrList: TStringList;
|
||
i: Integer;
|
||
dlg: TDlgLiteInfo;
|
||
pt: TPoint;
|
||
begin
|
||
Guard(StrList, TStringList.Create);
|
||
if MgSvc_.VulService.AvList <> nil then
|
||
begin
|
||
with MgSvc_.VulService do
|
||
begin
|
||
for i := 0 to AvList.Count - 1 do
|
||
StrList.Add(Format('%s ( %s :: %s )'#13#10, [AvList[i].Name, AvList[i].Status, AvList[i].AppType]));
|
||
end;
|
||
end else
|
||
StrList.Text := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ҷ<EFBFBD><D2B7><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>Դϴ<D4B4>...';
|
||
dlg := TDlgLiteInfo.Create(Self);
|
||
dlg.SetInfo('Anti-virus <20><><EFBFBD><EFBFBD>', StrList);
|
||
|
||
pt.X := imgAntiVirusInfo.Left;
|
||
pt.Y := imgAntiVirusInfo.Top;
|
||
pt := ClientToScreen(pt);
|
||
dlg.Left := pt.X - dlg.Width;
|
||
dlg.Top := pt.Y - dlg.Height;
|
||
|
||
dlg.Show;
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.imgCloseClick(Sender: TObject);
|
||
begin
|
||
{$IFDEF DEBUG}
|
||
if DebugHook <> 0 then
|
||
begin
|
||
Close;
|
||
Application.MainForm.Close;
|
||
end else
|
||
{$ENDIF}
|
||
VisibleMainform(false);
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.imgCloseMouseEnter(Sender: TObject);
|
||
begin
|
||
if Sender is TImage then
|
||
SetImgBtn(imgUpBtnList, TImage(Sender), TImage(Sender).Tag + 1);
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.imgCloseMouseLeave(Sender: TObject);
|
||
begin
|
||
if Sender is TImage then
|
||
SetImgBtn(imgUpBtnList, TImage(Sender), TImage(Sender).Tag);
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.imgFwInfoClick(Sender: TObject);
|
||
var
|
||
StrList: TStringList;
|
||
i: Integer;
|
||
dlg: TDlgLiteInfo;
|
||
pt: TPoint;
|
||
begin
|
||
Guard(StrList, TStringList.Create);
|
||
if MgSvc_.VulService.FwList <> nil then
|
||
begin
|
||
with MgSvc_.VulService do
|
||
begin
|
||
for i := 0 to FwList.Count - 1 do
|
||
StrList.Add(Format('%s ( %s :: %s )'#13#10, [FwList[i].Name, FwList[i].Status, FwList[i].AppType]));
|
||
end;
|
||
end else
|
||
StrList.Text := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ҷ<EFBFBD><D2B7><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>Դϴ<D4B4>...';
|
||
|
||
dlg := TDlgLiteInfo.Create(Self);
|
||
dlg.SetInfo('<27><>ȭ<EFBFBD><C8AD> <20><><EFBFBD><EFBFBD>', StrList);
|
||
|
||
pt.X := imgFwInfo.Left;
|
||
pt.Y := imgFwInfo.Top;
|
||
pt := ClientToScreen(pt);
|
||
dlg.Left := pt.X - dlg.Width;
|
||
dlg.Top := pt.Y - dlg.Height;
|
||
|
||
dlg.Show;
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.imgMainMouseDown(Sender: TObject; Button: TMouseButton;
|
||
Shift: TShiftState; X, Y: Integer);
|
||
begin
|
||
ReleaseCapture;
|
||
SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0);
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.imgMiniClick(Sender: TObject);
|
||
begin
|
||
WindowState := TWindowState.wsMinimized;
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.process_WM_POPUP_MSG(var msg: TMessage);
|
||
begin
|
||
// <20><><EFBFBD>α<CEB1> <20><><EFBFBD><EFBFBD> <20><> 3<>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD> <20>˾<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
if (dtStartTick_ <> 0) and ((GetTickCount - dtStartTick_) < 3000) then
|
||
exit;
|
||
|
||
TDlgNotice.Create(nil).PopupMessage(String(msg.LParam));
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.popTrayPopup(Sender: TObject);
|
||
begin
|
||
dtStartTick_ := 0;
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.process_WM_POPUP_LICENSE(var msg: TMessage);
|
||
var
|
||
sContent: String;
|
||
begin
|
||
sContent := String(msg.LParam);
|
||
with TDlgLicense.Create(nil) do
|
||
PopupLicense(sContent);
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.process_WM_POPUP_MSG_SYSTEM(var msg: TMessage);
|
||
begin
|
||
Sleep(500);
|
||
case msg.WParam of
|
||
TYPE_MSG_SYSTEM_VPNCLOSED :
|
||
begin
|
||
TrayIcon.BalloonFlags := bfInfo;
|
||
TrayIcon.BalloonTitle := TrayIcon.Hint;
|
||
TrayIcon.BalloonHint := '<27><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ȯ<><C8AF><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ǿ<EFBFBD><C7BE><EFBFBD><EFBFBD>ϴ<EFBFBD>.' + #13#10 +
|
||
'QS-eCRM Home Edition <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ǹ<EFBFBD>' + // #13#10 +
|
||
'<27><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>˴ϴ<CBB4>.';
|
||
TrayIcon.ShowBalloonHint;
|
||
end;
|
||
TYPE_MSG_SYSTEM_NETWORKCLOSE :
|
||
begin
|
||
TrayIcon.BalloonFlags := bfWarning;
|
||
TrayIcon.BalloonTitle := TrayIcon.Hint;
|
||
TrayIcon.BalloonHint := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ǿ<EFBFBD>,' + #13#10 +
|
||
'<27><>Ʈ<EFBFBD><C6AE>ũ<EFBFBD><C5A9> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>˴ϴ<CBB4>.' + #13#10 +
|
||
'<27><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>(VPN<50><4E><EFBFBD><EFBFBD>)<29><> <20>ʱ<EFBFBD>ȭ <20>˴ϴ<CBB4>.';
|
||
TrayIcon.ShowBalloonHint;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.process_WM_REFRESH_VIEW(var msg: TMessage);
|
||
begin
|
||
RefreshView;
|
||
end;
|
||
|
||
procedure TDlgeCrmHeMainOld.process_WM_SYSCOMMAND(var msg: TWMSysCommand);
|
||
begin
|
||
if msg.CmdType = SC_CLOSE then
|
||
begin
|
||
imgCloseClick(nil);
|
||
exit;
|
||
end;
|
||
Inherited;
|
||
end;
|
||
|
||
//procedure TDlgeCrmHeMain.process_WM_WINDOWPOSCHANGED(var msg: TMessage);
|
||
//begin
|
||
// UpdateVisibleExtendArrow;
|
||
// Inherited;
|
||
//end;
|
||
|
||
end.
|