function EnumFunc(AHwnd: THandle; AParam: Integer): Boolean; stdcall;<br>var<br> S: string;<br>begin<br> Result := True;<br> SetLength(S, 20);<br> SetLength(S, GetWindowText(AHwnd, PChar(S), 20));<br> if StrToIntDef(S, 0) > 0 then<br> begin<br> ShowMessage('QQ号: ' + S);<br> Result := False;<br> end;<br>end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> AHwnd: THandle;<br>begin<br> AHwnd := FindWindow('#32770', '发送消息');<br> EnumChildWindows(AHwnd, @EnumFunc, 0);<br>end;<br><br>