{The following code can analyze the object class name, handle, and its recursive parent class at the mouse under Windows, which is a piece of code in the tool software window superman who has been a fire bird. It triggers the Timer control, in fact, the better implementation is to trigger with Windows Mouse Hook, just when the brick is pushed; this code also implements a semi-transmigration window that does not rely on Windows2000 or more (Can Win98 / WinMe can also be half Transparent), the implementation of this implementation is more similar to the translation function similar to Jinshan word tyrants, but everyone is doing different applications. In the Delphi environment, create a new form, pick code, this tool mainly works some help from developers in a Windows environment (such as analyzing the control objects of others, tracking object handles, etc.)} Unit Unit1 ;
Interface
Uses Windows, Messages, Sysutils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, stdctrls
TYPE TFORM1 = Class (TFORM) Procedure Timer1Timer (sender: Tobject); Procedure formcreate; private {private declarations} end;
Var Form1: TFORM1; TIMER1: TTIMER;
IMPLEMENTATION
{$ R * .dfm}
Procedure TForm1.Timer1Timer (Sender: Tobject); Var Poss: TPOINT; IC: HDC; BMP: Tbitmap; Hands: hwnd; buf: array [0..129] of char; stmp: tstrings; itmp, iWidth, Iheight: integer Sword, Sline: String; Begin getCursorpos (POS); with self do begin if (poss.x <> tag-10) or (poss.y <> timer1.tag-10) Then Left: = Screen.Width Else Begin Hands: = WindowFromPoint (Poss); if (left = tag) or (hands = handle) THEN EXIT; stmp: = tstringlist.create; stmp.add ('handle:' INTOSTR (HANDS)); getClassName (Hands, BUF , 128); stmp.add ('class name:' buf); itmp: = getparent (hands); while itmp> 0 do begin getClassName (ITMP, BUF, 128); if BUF <> 'Then stmp.add (IntenTR (stmp.count-1) 'level parent class:' buf); itmp: = getParent (ITMP); end; sendMessage (hands, wm_gettext, 128, integer); sword: = 'characters : ' BUF; if Length (Sword)> 132 Then Sword: = Sword ' .... '; Repeat ITMP: = POS (Chr (10), Sword); if itmp> 0 THEN BEGIN SLIN E: = COPY (Sword, 1, ITMP-1); Sword: = Copy (Sword, ITMP 1, Length); Else Sline: = SWORD; itmp: = POS (chr (13), sline) If itmp> 0 Then Sline: = COPY (Sline, 1, ITMP-1); stmp.add (sline); until sline = sword; iWidth: = 0; for itmp: = 0 to stmp.count-1 DO if Canvas.textwidth (stmp [itmp]) 15> iWidth Then iWidth: = canvas.textwidth (stmp [itmp]) 15; Iheight: = stmp.count * (canvas.textheight (stmp [0]) 2); Width: = iWidth; Height: = iHEight;
SetWindowPos (Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE SWP_NOSIZE SWP_NOACTIVATE SWP_NOOWNERZORDER); ic: = CreateDC ( 'DISPLAY', nil, nil, nil); if tag width> screen.Width then tag: = Screen.width-width; if Timer1.tag height> screen.height kil1.tag: = screen.height-height; bmp: = tbitmap.create; bmp.width: = width; bmp.height: = height; bitblt (Bmp.canvas.handle, 0, 0, Width, Height, IC, Tag, Timer1.tag, srcopy; Left: = tag; Top: = Timer1.tag; Bitblt (canvas.handle, 0, 0, Width, Height, bmp.canvas.handle, 0, 0, srcand; canvas.font.color: = $ 0000FF; setBkmode (canvas.handle, transparent); for itmp: = 0 to stmp.count-1 do canvas.textout 5, 5 itmp * canvas.textheight (stmp [itmp]), trimright (stmp [itmp])); deletedc (IC); bmp.free; stmp.free; end; tag: = poss.x 10; Timer1 .Tag: = poss.y 10; end; end; procedure tform1.formcreate (sender: TOBJECT); Begin Self.Borderstyle: = bsnone; Timer1: = TTIMER.CREATE (Self); Timer1.Interval: = 300; Timer1 .Ontim Er: = Timer1Timer; end; end.