1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110:
| unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls;
type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Timer1: TTimer; Image1: TImage; Edit1: TEdit; Label3: TLabel; Label4: TLabel; Memo1: TMemo; ListBox1: TListBox; procedure Zahlen(Sender: TObject; var Key: Char); procedure TimerAus(Sender: TObject); procedure Extrahieren(CrPos: TPoint); procedure TimerAn(Sender: TObject); private
public
end;
var Form1: TForm1;
implementation
{$R *.DFM}
function Zeilen(hListBox: THandle): Integer; begin Result := SendMessage(hListBox, LB_GETCOUNT, 0, 0); end;
function AlleZeilen(hWnd: Hwnd; sl: TStrings): string; var RetBuffer: string; i, x, y: Integer; begin x := SendMessage(hWnd, LB_GETCOUNT, 0, 0); for i := 0 to x - 1 do begin y := SendMessage(hWnd, LB_GETTEXTLEN, i, 0); SetLength(RetBuffer, y); SendMessage(hWnd, LB_GETTEXT, i, lParam(PChar(RetBuffer))); sl.Add(RetBuffer); end; end;
procedure TForm1.Zahlen(Sender: TObject; var Key: Char); begin if not (key in [#8, #9, #48 .. #57]) then key:=#0; end;
procedure TForm1.TimerAus(Sender: TObject); var rPos: TPoint; begin if Boolean(GetCursorPos(rPos)) then Extrahieren(rPos); Timer1.Enabled := False; end;
procedure TForm1.Extrahieren(CrPos: TPoint); var hWnd: THandle; aName: array [0..255] of Char; sl: TStringList; ListBox_Handle: THandle; begin hWnd := WindowFromPoint(CrPos); Label1.Caption := 'Handle : ' + IntToStr(hWnd);
if Boolean(GetClassName(hWnd, aName, 256)) then Label2.Caption := 'ClassName : ' + string(aName); ListBox_Handle := StrToInt(aName); sl := TStringList.Create; ListBox1.Items.Text := sl.Text; sl.Free end;
procedure TForm1.TimerAn(Sender: TObject); begin Timer1.Enabled := True; Timer1.Interval := 3000; end;
end. |