Problem Source: http://www.cnblogs.com/del/archive/2008/02/28/1085432.html#1247615
To "mixed job": You mentioned the "input box" in IE at the same time, but you didn't understand what you mean. In this example, you just look for the top-level window. The "input box" in IE is a subwindow in IE window, on this basis, we need to continue to enumerate subwindows.
In this example (during the test, I opened: Sohu, Google, and my blog ):
Code File:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls; Type tform1 = Class (tform) button1: tbutton; memo1: tmemo; procedure formcreate (Sender: tobject); Procedure button1click (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} procedure tform1.formcreate (Sender: tobject); begin memo1.align: = altop; memo1.scrollbars: = ssbot H; memo1.clear; end; Procedure tform1.button1click (Sender: tobject); const classname = 'ieframework'; {This is the class name of IE browser} var H: hwnd; Buf: array [byte] of char; begin H: = getwindow (handle, gw_hwndfirst); while H 0 do begin getclassname (H, Buf, length (BUF )); if Buf = classname then {What should I do? Show its title} begin getwindowtext (H, Buf, length (BUF); memo1.lines. add (BUF) end; H: = getwindow (H, gw_hwndnext); end.
Form file:
Object form1: tform1 left = 0 Top = 0 caption = 'form1 'clientheight = 168 clientwidth = 319 color = clbtnface font. charset = default_charset font. color = clwindowtext font. height =-11 font. name = 'tahoma 'font. style = [] oldcreateorder = false oncreate = formcreate pixelsperinch = 96 textheight = 13 object button1: tbutton left = 126 Top = 127 width = 75 Height = 25 caption = 'button1' taborder = 0 onclick = button1click end object memo1: tmemo left = 8 Top = 8 width = 185 Height = 113 lines. strings = ('memo1') taborder = 1 endend