function GetButtonHandle(hwnd: Integer; lparam: Longint): Boolean; stdcall;<br>var<br> buffer: array[0..255] of Char;<br> buffer1: array[0..255] of Char;<br>begin<br> Result := True;<br> //得到目标窗口的控件<br> GetClassName(hwnd, buffer, 256);<br> //找到发消息的目标窗口的目标控件<br> if StrPas(Buffer) = 'Button' then<br> begin<br> GetWindowText(hwnd, buffer1, 100);<br> if buffer1 = '送讯息(&S)' then<br> begin<br> PInteger(lparam)^ := hwnd; //得到目标控件的Hwnd(句柄)<br> Result := False; //终止循环<br> end;<br> end;<br>end; //end of function<br>。。。。。。。。。。。。。。。。。。。。。。。。。。<br>EnumChildWindows(Handle, @GetButtonHandle, Integer(@Handle));