[阅读: 495] 2007-02-02 02:21:07
procedure TDataBackUp.FormClose(Sender: TObject; var Action: TCloseAction);
var
hCurrentWindow:hwnd;
szText:array[0..254] of char;
begin
//检查TFTP服务是否开启,若开启则关闭
hcurrentwindow:=getwindow(handle,gw_hwndfirst);
while hcurrentwindow<>0 do
begin
if (getwindowtext(hcurrentwindow,@sztext,255)>0) and (Pos('Cisco TFTP Server',strpas(@sztext))>0) then
begin
SendMessage(hcurrentwindow,WM_CLOSE,0,0);
break;
end;
hcurrentwindow:=getwindow(hcurrentwindow,gw_hwndnext);
end;
end;