本来说上传的,但没找到服务器,不知道哪位老兄告知一二。
TO alan stephen:
请试试如下代码:
procedure TForm1.closeClick(Sender: TObject);
var
i:integer;
hCurrentWindow: HWnd;
szText: array[0..254] of char;
begin
if Edit1.Text<>'' then begin
hCurrentWindow := GetWindow(Handle, GW_HWNDFIRST);
i:=hCurrentWindow;
While hCurrentWindow <> 0 Do
Begin
If GetWindowText(hCurrentWindow, @szText, 255) > 0 Then begin
if Strpas(@szText)=Edit1.Text then
postmessage(hCurrentWindow,WM_SYSCOMMAND,SC_CLOSE,0);
end;
hCurrentWindow := GetNextWindow(hCurrentWindow, GW_HWNDNEXT);
End;
end;
end;