J
jianguo_bu
Unregistered / Unconfirmed
GUEST, unregistred user!
我是如下这样做的,但经调试BUF里总是为一空格,请问为什么?<br>function EnumWindowsProc(Handle: HWND; lParam: LPARAM): Boolean;<br>var<br> CaptionBuf: PCHAR ;<br> Buf: String;<br>begin<br>// 查找特定的按钮,然后发送消息<br> GetMem(CaptionBuf, 256);<br> try<br> GetWindowText(Handle, CaptionBuf, 255);<br> Buf := strpas(CaptionBuf);<br> Form1.Memo1.Lines.Append(IntToStr(Handle) + ': ' + Buf);<br> if Buf = 'button1' then<br> begin<br> SendMessage(Handle, WM_LBUTTONDOWN, 0, 0);<br> end;<br> finally<br> FreeMem(CaptionBuf);<br> end;<br> Result := True;<br>end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> WindowHandle: HWND;<br> vlParam: Integer;<br><br>begin<br> WindowHandle := FindWindow(nil, 'form1');<br> Memo1.Clear;<br> Memo1.Lines.Append(IntToStr(WindowHandle) + 'from1');<br> vlParam := 0;<br> EnumChildWindows(WindowHandle, @EnumWindowsProc, vlParam);<br>end;<br>