{*******************************************************} { } { DrmAstHook } { } { Copyright (C) 2022 kku } { } {*******************************************************} unit DrmAstHook; interface uses System.SysUtils, System.Classes, Tocsg.DllEntry, Winapi.Windows, Winapi.Messages, Winapi.ShellAPI, System.Generics.Collections, Tocsg.Trace; type TDrmAstHook = class(TKuDllEntry) private Trace_: TTgTrace; public Constructor Create; Destructor Destroy; override; end; implementation Constructor TDrmAstHook.Create; var sPath: String; StrList: TStringList; h: HWND; begin Inherited Create; {$IFDEF DEBUG} Trace_ := TTgTrace.Create('C:\taskToCSG\Tocsg.Module\TocsgDRM\OUT_Debug - Win32\', 'DrmAssistor.log'); {$ENDIF} _Trace('Create()'); sPath := 'C:\taskToCSG\Tocsg.Module\TocsgDRM\OUT_Debug - Win32\ccc.txt'; if FileExists(sPath) then begin _Trace('Create() .. 1'); StrList := TStringList.Create; StrList.LoadFromFile(sPath); h := StrToInt64Def(Trim(StringReplace(StrList.Text, #13#10, '', [rfReplaceAll])), 0); if h <> 0 then begin _Trace('Create() .. 2'); SetWindowDisplayAffinity(h, WDA_MONITOR); end; StrList.Free; DeleteFile(PChar(sPath)); _Trace('Create() .. 99'); end; end; Destructor TDrmAstHook.Destroy; begin {$IFDEF DEBUG} FreeAndNil(Trace_); {$ENDIF} Inherited; end; end.