hw:=FindWindow(nil,PChar('窗口的标题名称'));
function EnumWindowsProc(Wnd: HWND; Param: Integer): Boolean; stdcall;
var
cn : Array[0..255] of char;
tab : HWND;
tId : DWORD;
begin
Result := TRUE;
if GetClassName(wnd, cn, 255) > 0 then
if cn = '#32770' then
begin
if (FindWindowEx(wnd, 0, 'Button','新建窗口') <> 0) and
(FindWindowEx(wnd, 0, 'Button','拨打电话') <> 0) and
(FindWindowEx(wnd, 0, 'Button','发送(Enter)') <> 0) then
begin
tID := GetWindowThreadProcessID(wnd, nil);
Form1.Memo1.Lines.Add('对话框句柄:'+IntToStr(Wnd));
Form1.Memo1.Lines.Add('对话框线程ID:' + IntToSTr(tID));
end;
end;
end;
begin
EnumWindows(@EnumWindowsProc,0);
end;
FindWindowEx(wnd, 0, 'Button','拨打电话')