initial commit
[rofl0r-KOL.git] / openPass / Unit1.pas
blob2b24f72b4f1d1882d4fe76331343aeb74974a89a
1 { KOL MCK } // Do not remove this line!
2 {$DEFINE KOL_MCK}
3 unit Unit1;
5 interface
7 {$IFDEF KOL_MCK}
8 uses Windows, Messages, ShellAPI, KOL, KOLMHAboutDialog, KOLMHXP {$IFNDEF KOL_MCK}, mirror, Classes, Controls, mckCtrls, mckObjs, MCKMHAboutDialog,
9 MCKMHXP, {$ENDIF};
10 {$ELSE}
11 {$I uses.inc}
12 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
13 mirror;
14 {$ENDIF}
16 type
17 {$IFDEF KOL_MCK}
18 {$I MCKfakeClasses.inc}
19 PForm1 = ^TForm1;
20 TForm1 = object(TObj)
21 Form: PControl;
22 {$ELSE not_KOL_MCK}
23 TForm1 = class(TForm)
24 {$ENDIF KOL_MCK}
25 KOLProject1: TKOLProject;
26 KOLForm1: TKOLForm;
27 PassEd: TKOLEditBox;
28 CopyRightL: TKOLLabel;
29 Timer1: TKOLTimer;
30 MainMenu1: TKOLMainMenu;
31 MHAboutDialog1: TKOLMHAboutDialog;
32 MHXP1: TKOLMHXP;
33 procedure Timer1Timer(Sender: PObj);
34 procedure KOLForm1FormCreate(Sender: PObj);
35 procedure KOLForm1N2Menu(Sender: PMenu; Item: Integer);
36 private
37 { Private declarations }
38 public
39 { Public declarations }
40 Version:String;
41 end;
43 var
44 Form1 {$IFDEF KOL_MCK} : PForm1 {$ELSE} : TForm1 {$ENDIF} ;
46 {$IFDEF KOL_MCK}
47 procedure NewForm1( var Result: PForm1; AParent: PControl );
48 {$ENDIF}
50 implementation
52 {$IFNDEF KOL_MCK} {$R *.DFM} {$ENDIF}
54 {$IFDEF KOL_MCK}
55 {$I Unit1_1.inc}
56 {$ENDIF}
58 procedure TForm1.Timer1Timer(Sender: PObj);
59 var
60 CPos: TPoint;
61 CWindow: HWND;
62 Buf:array [0..255] of Char;
63 WStyle:DWord;
64 WL: LongInt;
65 R:Trect;
66 begin
68 GetCursorPos(CPos);
69 CWindow:= WindowFromPoint(CPos);
70 // Ôóíêöèÿ GetWindowText íå äàåò òåêñòà èç äðóãîãî îêíà !!!
71 // à ñîîáùåíèå WM_GETTEXT äàåò !!!
72 SendMessage(CWindow,WM_GETTEXT,LongInt(SizeOf(Buf)),LongInt(@Buf));
73 // Ñíåìè ïàðîëü
74 WL:= GetWindowLong(CWindow, GWL_STYLE);
75 if ((LongInt(ES_PASSWORD)) and WL) <> 0 then
76 begin
77 SendMessage(CWindow,EM_SETPASSWORDCHAR,0,0);
78 SendMessage(CWindow,WM_PAINT,GetDC(CWindow),0);
79 end;
81 // Åñëè ó òåáÿ íåò èìÿíè, òî ìîæåò ó ðîäèòåëÿ åñòü?!
82 // ***
83 // if StrPas(Buf)='' then
84 // SendMessage(GetParentWindow(CWindow),WM_GETTEXT,LongInt(SizeOf(Buf)),LongInt(@Buf));
85 if PassEd.Text<>String(Buf) then
86 PassEd.Text:=String(Buf);
88 end;
90 procedure TForm1.KOLForm1FormCreate(Sender: PObj);
91 begin
92 // V1.1 15-nov-2001
93 Version:='1.1';
94 Form1.Form.Caption:=Form1.Form.Caption+Version;
95 end;
97 procedure TForm1.KOLForm1N2Menu(Sender: PMenu; Item: Integer);
98 begin
99 MHAboutDialog1.Execute;
100 end;
102 end.