问题描述:
获得窗口句柄后,
如何得到这个窗口上的某个按钮,
并且改变这个按钮的Caption属性

解决方案 »

  1.   

    Handle:为已知的句柄var
      h:HWND;
      con:TControl;
    begin
      h := FindWindowEx(Handle,0,'TButton','Button1');
      if h = 0 then Exit;
      con := FindControl(h);
      if con = nil then Exit;
      if not (con is TButton) then Exit;
      TButton(con).Caption := 'dddd';
    end;
      

  2.   

    仅对标准的BUTTON类有效:EnumChildWindows
    GetClassName => 'BUTTON'
    SetWindowText
      

  3.   

    先用FindWidowEx找到这个按钮的handle
    再用FindControl得到这个按钮
    再改Caption
      

  4.   

    楼上的牛人都说完了。55
    俺也说一下:
    1.使用 GetWindow(Handle, GW_CHILD);
      得到句柄
    2.使用 GetClassName 取得控件的class名称
    3.判断取得的class名称是否为 “Button”
    4.根据句柄,使用 GetWindowText 改变 Caption 即可。
      

  5.   

    更正一下。
    4.使用 SetWindowText API 改变Caption