Enumeration of all current IE Windows-Reply to "mixed posts"

Source: Internet
Author: User
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

   

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.