84 lines
1.6 KiB
Plaintext
84 lines
1.6 KiB
Plaintext
unit DAtTktKeyMain;
|
|
|
|
interface
|
|
|
|
uses
|
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
|
|
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls;
|
|
|
|
type
|
|
TDlgAtTktKeyMain = class(TForm)
|
|
tInput: TTimer;
|
|
lbMsg: TLabel;
|
|
procedure tInputTimer(Sender: TObject);
|
|
private
|
|
{ Private declarations }
|
|
sTokenKey_: String;
|
|
public
|
|
{ Public declarations }
|
|
Constructor Create(aOwner: TComponent); override;
|
|
end;
|
|
|
|
var
|
|
DlgAtTktKeyMain: TDlgAtTktKeyMain;
|
|
|
|
implementation
|
|
|
|
uses
|
|
Tocsg.WndUtil, Tocsg.Keyboard, Tocsg.Param;
|
|
|
|
{$R *.dfm}
|
|
|
|
Constructor TDlgAtTktKeyMain.Create(aOwner: TComponent);
|
|
|
|
procedure InitKey;
|
|
var
|
|
param: TTgParam;
|
|
begin
|
|
param := TTgParam.Create;
|
|
sTokenKey_ := param.GetParamValue('/key');
|
|
param.Free;
|
|
end;
|
|
|
|
begin
|
|
Inherited Create(aOwner);
|
|
Left := Screen.PrimaryMonitor.Width - Width - 200;
|
|
Top := 100;
|
|
InitKey;
|
|
tInput.Enabled := true;
|
|
end;
|
|
|
|
procedure TDlgAtTktKeyMain.tInputTimer(Sender: TObject);
|
|
//const
|
|
// TOKEN_KEY = 'Q8fbju0Ez@';
|
|
var
|
|
h, hChild: HWND;
|
|
begin
|
|
if sTokenKey_ = '' then
|
|
begin;
|
|
TerminateProcess(GetCurrentProcess, 99);
|
|
exit;
|
|
end;
|
|
|
|
h := FindWindow(nil, 'ÅäÅ« ·Î±×¿Â');
|
|
if h <> 0 then
|
|
begin
|
|
Sleep(500);
|
|
SetForegroundWindow(h);
|
|
hChild := 0;
|
|
hChild := GetWndChildClass(h, 'Edit', hChild);
|
|
while hChild <> 0 do
|
|
begin
|
|
if GetEditText(hChild) = '' then
|
|
begin
|
|
SetEditText(hChild, sTokenKey_);
|
|
PressKeys(#13);
|
|
exit;
|
|
end;
|
|
hChild := GetWndChildClass(h, 'Edit', hChild);
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
end.
|