这是我的软件里的一段代码,判断另外一个软件里的“记住密码”复选框是否已选中。<br>function EnumChildWindowsProc(hwnd: Integer; lparam: Longint):Boolean; <br>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='记住密码' then<br> begin<br> PInteger(lparam)^ := hwnd;// 得到目标控件的Hwnd(句柄)<br> Result:=False; //终止循环<br> end;<br> end;<br> end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> ischeck:integer;<br> hcheckbox:hwnd;<br>begin<br>hcheckbox:=findwindow('#3321',nil);//b程序的checkbox得句柄<br>EnumChildWindows(findwindow('#3321',nil),@EnumChildWindowsProc,Integer(@hcheckbox));<br><br>isCheck:=SendMessage(hcheckbox, BM_GETCHECK, 0, 0) ;<br>if isCheck=0 then<br> showmessage('not check')<br>else<br> showmessage('check');<br>end;