怎样列出某窗口下所有Edit控件~有源码给分?假设已知某程序A的某窗口的Captain属性为“ABC”
怎样通过另一个程序B列出程序A的该窗口下所有Edit控件
怎样通过另一个程序B列出程序A的该窗口下所有Edit控件
解决方案 »
- Delphi 将DBGrid中数据导出到Excel中,采用逐个读取DBGrid单元数据,写到Excel中,这种情况下如何解决‘0123’导出后变成‘123’的问
- 如何获取在资源浏览器上拖曳放开鼠标时IDataObject将要存放的路径
- 请问下Pascal语言中二维数组A[3,4],是3表示行数还是4表示行数
- 窗体间返回值的问题!!!(菜鸟提问)
- 关于鼠标事件!
- 2000与98的兼容问题
- 数量及单价在数据库设计的时侯定义什么类型最佳?
- 怎样在delphi中检测sql server有没有安装?如果安装了怎样取得sql服务器名?(急,在线)
- 请教如何判断EDIT输入框中的字符为有效的字符谢谢
- 关于ComboBox的一个简单问题
- lonaerd(罗纳尔多) 进来领分(50),再顺便问个问题,怎么判断字符为单引号?(20)
- 我还有一个问题:如何吧“任务”栏弄没了????
begin
if Controls[I] is TEdit then....
begin
if Controls[I] is TEdit then
DWGZ已经给出答案了
if (Screen.Forms[I] as TForm).Caption='ABC' then
for J:=0 to Application.ComponentCount-1 do
if (Application.Components[J] is TEdit) and (((Application.Components[J] as TEdit)).Parent=Screen.Forms[I] as TForm) then
ShowMessage('Found One!');
var
a: array[0..255] of AnsiChar;
begin
Result := '';
if hWindow <= 0 then Exit;
if not IsWindow(hWindow) then Exit; GetClassNameA(hWindow, @a, SizeOf(a));
Result := WideString(PAnsiChar(@a));
end;var
sList: TStrings;procedure GetEditHwnds(hWindow: THandle; OutList: TStrings); function ECWPEdits(h: HWND; lPar: LPARAM): LongBool; stdcall;
var
s: string;
begin
Result := True;
s := uhwGetClassName(h);
if SameText(s, 'Edit') or SameText(s, 'TEdit') then
sList.Add(IntToStr(h));
end;begin
sList := OutList;
EnumChildWindows(hWindow, @ECWPEdits, 0);
end;procedure TForm1.Button1Click(Sender: TObject);
var
h: THandle;
OutList: TStrings;
begin
h := FindWindow(nil, 'ABC');
if h = 0 then Exit; OutList := TStringList.Create;
try
GetEditHwnds(h, OutList);
ListBox1.Clear;
ListBox1.Items.AddStrings(OutList);
finally
OutList.Free;
end;
end;
-------------------------------
风过西窗客渡舟船无觅处
年年一川新草遥看却似旧