基于窗口内的某个空间上的固定的不可选的标签文字,如何获取?
不知道控件的名称,长度也不固定,但是开始位置基本上固定。
请问如何获取,并赋值给某个Edit控件?
谢谢!

解决方案 »

  1.   

    for I := 0 to  self.ControlCount-1 do
      begin
        if controls[i] is Tlabel then
        begin
           controls[i] as Tlabel;
           ShowMessage(Tlabel(Controls[i]).caption);
        end;
      end;
      

  2.   

    你这个是不是获取所有LABEL的CAPTION啊!那我仅仅需要其中一个或几个,与别的地方的内容进行比较,这样就没办法检索了
      

  3.   

    deansroom(丁樵方玉) 已经说了,找窗口内的标签,你再判断一下标签的位置,符合的就取caption值就好了
      

  4.   

    for I := 0 to  self.ComponentCount-1 do
      begin
        if Components[i] is Tlabel then
        begin
           Components[i] as Tlabel;
           ShowMessage(Tlabel(Components[i]).caption);
        end;
      end;
    [Delphi] property Components: TComponent read GetComponent;
    Description 
    Use Components to access any of the components owned by this component, such as the components owned by a form. The Components property is most useful when referring to owned components by number rather than name. It is also used internally for iterative processing of all owned components.
     
    Index ranges from 0 to ComponentIndex minus 1.
      

  5.   

    但问题是他要不是DELPHI的程序呢?标签还是TLABEL吗?还有!窗口的位置是根据当前画面像素的大小在改变的吧!
      

  6.   

    for I := 0 to  self.ControlCount-1 do
      begin
        if controls[i] is Tlabel then
        begin
           controls[i] as Tlabel;
           if Tlabel(Controls[i]).caption='label1' then
           ShowMessage(Tlabel(Controls[i]).caption);
        end;
      end;
      

  7.   

    网上有许多类似源码:
    http://www.delphifans.com/SoftView/SoftView_550.html
      

  8.   

    keiy() ( ) 信誉:105 推荐的源码不错 呵呵 我是楼主肯定要给他分了 
    ^_^
      

  9.   

    api函数  取得窗口的handle在
    gettext()