每一个控件创建时会被分配一个ID,计算一下就可以了,如果用的是默认的ID的话。

解决方案 »

  1.   


    length Property  Internet Development Index --------------------------------------------------------------------------------Sets or retrieves the number of objects in a collection.What's New for Microsoft® Internet Explorer 6
    This property now applies to the comment object. SyntaxHTML N/A 
    Scripting object.length [ = iLength ] Possible ValuesiLength Integer that specifies or receives the number of objects. The property is read/write for all objects except the following, for which it is read-only: COMMENT, pages. The property has no default value.ResThe window.length property returns the number of frames contained in a window.The comment.length property returns the number of characters in the object.Although this property is read-only for most of the objects listed in the Applies To section objects, it is read/write for the areas collection (image maps), the options collection (select boxes), and the select object.In all other cases, this property has read-only permission, which means you can retrieve, but cannot change, its current value.The form.length property does not count input type=image elements. To access all elements contained in a form, use the children collection.For Microsoft Windows® CE only, this collection will always be empty.Standards InformationThis property is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 . Applies To[ Object Name ] 
    Platform Version 
    Win16:  
    Win32:  
    Windows CE:  
    Unix:  
    Mac:  
    Version data is listed when the mouse hovers over a link, or the link has focus. 
     all, anchors, applets, areas, attributes, behaviorUrns, books, boundElements, cells, childNodes, children, COMMENT, controlRange, elements, embeds, filters, forms, frames, images, imports, links, namespaces, options, pages, plugins, rows, rules, scripts, SELECT, styleSheets, tBodies, TextRectangle, TextRange, window, FORM 
    Move the mouse pointer over an element in the Applies To list to display availability information for the listed platforms. 
     
      

  2.   

    use API findwindow and  EnumChildWindows