U_FrmSearchNetIp.pas
上传用户:hbxylj
上传日期:2013-05-06
资源大小:240k
文件大小:17k
源码类别:

扫描程序

开发平台:

Delphi

  1. unit U_FrmSearchNetIp;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Classes, Graphics, Controls,
  5.   WinSock,Forms, Dialogs, StdCtrls, ExtCtrls, Buttons,
  6.   Grids, ComCtrls;
  7. const
  8.   WM_SOCK = WM_USER + 1;     {自定义windows消息}
  9.   NBTPORT =  137;         {向对方的137端口发数据包(UDP包)}
  10. Type
  11.   TTGroupNet=record {网络标识}
  12.       IP:string;
  13.       ComputerName:string;
  14.       ComputerDes:string;
  15.       NetGroup:string;
  16.       NetMacCode:string;
  17.   end;
  18. type
  19.   TSearchNetIp_frm = class(TForm)
  20.     SBrnScanNetIP: TSpeedButton;
  21.     SBtnStopScan: TSpeedButton;
  22.     stabar: TStatusBar;
  23.     SgDispNetIP: TListView;
  24.     Edit1: TEdit;
  25.     Edit2: TEdit;
  26.     Label1: TLabel;
  27.     Label2: TLabel;
  28.     procedure FormCreate(Sender: TObject);
  29.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  30.     procedure SBtnStopScanClick(Sender: TObject);
  31.     procedure SBrnScanNetIPClick(Sender: TObject);
  32.     procedure SgDispNetIPSelectCell(Sender: TObject; ACol, ARow: Integer;
  33.       var CanSelect: Boolean);
  34.     procedure SgDispNetIPDblClick(Sender: TObject);
  35.     procedure RxSEdDelayKeyPress(Sender: TObject; var Key: Char);
  36.   private
  37.     { Private declarations }
  38.     procedure ReadData(var Message: TMessage); message WM_SOCK;  {消息接送}
  39.     Procedure ClearGrid();
  40.     Procedure MakeGrid(Const IntIndex:integer=3);{排序}
  41.   public
  42.     { Public declarations }
  43.   end;
  44. {*******************************************************}
  45.   TComread=class(TThread) {通讯线程}
  46.   private
  47.   public
  48.    Tagg:integer;
  49.   protected
  50.     procedure Execute; override;
  51.   end;
  52.   {始化SOCKET}
  53.   Procedure WinSockInital(Handle: HWnd);
  54.   {关闭SOCKET}
  55.   Procedure WinSockClose();
  56. const NbtstatPacket:array[0..49]of byte  {发送数据包}
  57.       =($0,$0,$0,$0,$0,$1,
  58.       $0,$0,$0,$0,$0,$0,$20,$43,$4b,
  59.       $41,$41,$41,$41,$41,$41,$41,$41,
  60.       $41,$41,$41,$41,$41,$41,$41,$41,
  61.       $41,$41,$41,$41,$41,$41,$41,$41,
  62.       $41,$41,$41,$41,$41,$41,$0,$0,$21,$0,$1);
  63. {*******************************************************}
  64. var
  65.   SearchNetIp_frm: TSearchNetIp_frm;
  66.   TF_stop:boolean;  {停止}
  67.   TempWSAData: TWSAData;
  68.   sockfd:TSocket;     {Integer socket句柄}
  69.   WAIT_ACK_EVENT:Thandle; {LongWord  句柄|}
  70.   FSockAddrIn : TSockAddrIn;
  71.   IP_count,ComputerIP:integer;
  72.   IP_end:     Dword;
  73.   StartTickCount:DWORD ; {计数器}
  74.   StopTickCount: DWORD ;
  75.   TGroupNet:array of TTGroupNet;{网络信息寄存}
  76.   IntGridCol:integer;
  77.   
  78. implementation
  79. {$R *.DFM}
  80. procedure TSearchNetIp_frm.FormCreate(Sender: TObject);
  81. begin
  82.     IntGridCol:=0;
  83.     {TRxRichEdit 去除64K的限制}
  84.     //RxRedDispinf.MaxLength := High(Integer) - 1024;
  85.     {Grid清除 ClearGrid}
  86.     ClearGrid;
  87. end;
  88. procedure TSearchNetIp_frm.FormClose(Sender: TObject;
  89.   var Action: TCloseAction);
  90. begin
  91.   TF_stop:=True;
  92.   setlength(TGroupNet,0);
  93.   {关闭SOCKET}
  94.   WinSockClose();
  95. end;
  96. {停止扫描}
  97. procedure TSearchNetIp_frm.SBtnStopScanClick(Sender: TObject);
  98. begin
  99.  TF_stop:=True;
  100.  close;
  101. end;
  102. {****************** SOCKET通讯  *****************}
  103. {始化SOCKET}
  104. Procedure WinSockInital(Handle: HWnd);
  105. begin
  106.      { 1 初始化SOCKET}
  107.      TF_stop:=false;
  108.      if WSAStartup(2, TempWSAData)=1 then
  109.      begin
  110.        showmessage('Socket初始化出错');
  111.        exit
  112.      end;
  113.      {若是用UDP通信,则用}
  114.      sockfd:=Socket(AF_INET,SOCK_DGRAM,0);
  115.      FSockAddrIn.SIn_Family := AF_INET;
  116.      FSockAddrIn.SIn_Port := htons(NBTPORT);  {137端口}
  117.     {Socket的信息传递--》From.Handle 窗体, FD_READ 在读就绪的时候, WM_SOCK 自定义消息号}
  118.      WSAAsyncSelect(sockfd, Handle , WM_SOCK, FD_READ);
  119.     {创建事件}
  120.      WAIT_ACK_EVENT:=CreateEvent(nil,true,false,pchar('WAIT_ACK') );
  121.      ResetEvent(WAIT_ACK_EVENT);
  122. end;
  123. {关闭SOCKET}
  124. Procedure WinSockClose();
  125. begin
  126.    TF_stop:=True;
  127.    CloseSocket(sockfd); {closesocket函数用来关闭一个描述符为sockfd套接字}
  128.    WSACleanup;
  129.    sleep(2);
  130. end;
  131. {****************** SOCKET通讯  *****************}
  132. {扫描开始}
  133. procedure TSearchNetIp_frm.SBrnScanNetIPClick(Sender: TObject);
  134. var
  135.   DWx1,Dwx:Dword;
  136.   IP,Str_Ip,begin_ip,end_ip:string;
  137.   Tcomr:TComread;
  138. begin
  139.    //RxRichEdit1.text:='';
  140.    Setlength(TGroupNet,0);
  141.    {始化SOCKET}
  142.    WinSockInital(SearchNetIp_frm.Handle);
  143.    {清除Grid}
  144.    ClearGrid;
  145.    TF_stop:=false;
  146.    begin_ip:=edit1.Text;
  147.    IP:=begin_ip;
  148.    //RxRedDispinf.Text :='';
  149.    stabar.Panels[0].Text:='';
  150.    stabar.Panels[1].Text:='';
  151.    stabar.Panels[1].Text:='扫描用时:';
  152.    if Longword(inet_addr(pchar(IP)))=INADDR_NONE then
  153.    begin
  154.       Messagebox(Application.handle,pchar(IP + ' TP 出错'),'警告',MB_OK+MB_ICONERROR);
  155.       exit;
  156.    end;
  157.    end_ip:=edit2.Text;
  158.    IP:=end_ip;
  159.    if Longword(inet_addr(pchar(IP)))=INADDR_NONE then
  160.    begin
  161.       Messagebox(Application.handle,pchar(IP + ' TP 出错'),'警告',MB_OK+MB_ICONERROR);
  162.       exit;
  163.    end;
  164.     IP:=begin_ip;
  165.     ComputerIP:=inet_addr(PChar(IP)) ;  // 192.168.0.1 ===>01 00 A8 C0
  166.     str_ip:=inttohex(ComputerIP,8);    //01 00 A8 C0
  167.     str_ip:=copy(str_ip,7,2)+copy(str_ip,5,2)+copy(str_ip,3,2)+copy(str_ip,1,2);   //==> C0 A8 00 01
  168.     DWx:=strtoint('$'+str_ip); {转换成为一个长整形数}
  169.     str_ip:=inttohex(ComputerIP,8);
  170.     str_ip:=inttostr(strtoint('$' + copy(str_ip,7,2)))
  171.                 +'.' + inttostr(strtoint('$' + copy(str_ip,5,2)))
  172.                 +'.' + inttostr(strtoint('$' + copy(str_ip,3,2)))
  173.                 +'.' + inttostr(strtoint('$' + copy(str_ip,1,2)));
  174.     //EdNetIP1.text:=str_ip;  {允许输入 一个数值表示IP}
  175.     IP:=end_ip;
  176.     ComputerIP:=inet_addr(PChar(IP)) ;  // 192.168.0.1 ===>01 00 A8 C0
  177.     str_ip:=inttohex(ComputerIP,8);    //01 00 A8 C0
  178.     str_ip:=copy(str_ip,7,2)+copy(str_ip,5,2)+copy(str_ip,3,2)+copy(str_ip,1,2);   //==> C0 A8 00 01
  179.     DWx1:=strtoint('$'+str_ip);   {转换成为一个长整形数}
  180.     str_ip:=inttohex(ComputerIP,8);
  181.     str_ip:=inttostr(strtoint('$' + copy(str_ip,7,2)))
  182.                +'.' + inttostr(strtoint('$' + copy(str_ip,5,2)))
  183.                +'.' + inttostr(strtoint('$' + copy(str_ip,3,2)))
  184.                +'.' + inttostr(strtoint('$' + copy(str_ip,1,2)));
  185.     //EdNetIP2.text:=str_ip;  {允许输入 一个数值表示IP}
  186.      if DWx1>Dwx then
  187.      begin
  188.         IP_count:=DWx1-Dwx;
  189.         ComputerIP:=inet_addr(PChar(begin_ip));
  190.         IP_end:=DWx1;
  191.      end
  192.      else begin
  193.         IP_count:=DWx-Dwx1;
  194.         ComputerIP:=inet_addr(PChar(end_ip));
  195.         IP_end:=DWx;
  196.      end;
  197.     SBrnScanNetIP.Enabled :=false;  {屏蔽按键}
  198.     Tcomr:=TComread.Create(True);
  199.     StartTickCount:=GetTickCount;
  200.     Tcomr.Resume ;  {开始线程}
  201. end;
  202. { TComread }
  203. {通讯线程}
  204. procedure TComread.Execute;
  205. var
  206.    str_ip:string;
  207.    IP_now:Dword;
  208.    Procedure MakeEnd();
  209.    begin
  210.      SearchNetIp_frm.SBrnScanNetIP.Enabled :=True;
  211.      StopTickCount:=GetTickCount;
  212.      SearchNetIp_frm.stabar.Panels[1].Text:='扫描用时:' +FloatToStr(StopTickCount-startTickCount)+' mS';
  213.      SearchNetIp_frm.stabar.Panels[0].Text:='IP个数:'+inttostr(SearchNetIp_frm.SgDispNetIP.Items.Count);
  214.  {排序
  215.  'TP地址'0  '计算机名称'1  '计算机描述' 2
  216.  '网络组'3  '网卡MAC码'4
  217.   MakeGrid(const IntIndex: integer=3);}
  218.    end;
  219. begin
  220.   with SearchNetIp_frm do
  221.   begin
  222.      str_ip:=inttohex(ComputerIP,8);    //01 00 A8 C0
  223.      str_ip:=copy(str_ip,7,2)+copy(str_ip,5,2)+copy(str_ip,3,2)+copy(str_ip,1,2);   //==> C0 A8 00 01
  224.      IP_now:=strtoint('$'+str_ip);
  225.       while IP_end>=IP_now do         ////IP_end==> C0 A8 00 01
  226.       begin
  227.          if TF_stop=True then
  228.          begin
  229.           MakeEnd();
  230.           {关闭SOCKET}
  231.           WinSockClose();
  232.           exit;
  233.          end;
  234.          str_ip:=inttohex(ComputerIP,8);
  235.          str_ip:=inttostr(strtoint('$' + copy(str_ip,7,2)))
  236.                 +'.' + inttostr(strtoint('$' + copy(str_ip,5,2)))
  237.                 +'.' + inttostr(strtoint('$' + copy(str_ip,3,2)))
  238.                 +'.' + inttostr(strtoint('$' + copy(str_ip,1,2)));
  239.          stabar.Panels[0].Text:=str_ip;  {目前扫描的IP}
  240.          FSockAddrIn.SIn_Addr.S_addr := ComputerIP;//inet_addr(pchar(IP));
  241.          str_ip:=inttohex(ComputerIP,8);    //01 00 A8 C0
  242.          str_ip:=copy(str_ip,7,2)+copy(str_ip,5,2)+copy(str_ip,3,2)+copy(str_ip,1,2);   //==> C0 A8 00 01
  243.          str_ip:=inttohex( strtoint(('$' + str_ip))+1,8);      //==> 加一C0 A8 00 02
  244.          IP_now:=strtoint('$'+str_ip);
  245.          str_ip:=copy(str_ip,7,2)+copy(str_ip,5,2)+copy(str_ip,3,2)+copy(str_ip,1,2);  //==>02 00 A8 C0
  246.          ComputerIP:=strtoint('$'+str_ip);
  247.          sendto(sockfd, NbtstatPacket,50, 0, FSockAddrIn, sizeof(FSockAddrIn));
  248.          //发送数据后
  249.          waitforsingleobject(WAIT_ACK_EVENT,10); // 等待事件变成有信号
  250.          ResetEvent(WAIT_ACK_EVENT);      // 设为没有信号
  251.       end;
  252.       MakeEnd();
  253.   end;
  254.  {关闭SOCKET}
  255.   WinSockClose();
  256. end;
  257. { TFrmSearchNetIp }
  258. {消息接送}
  259. procedure TSearchNetIp_frm.ReadData(var Message: TMessage);
  260. var
  261.   list:Tlistitem;
  262. var
  263.    Buffer: Array [1..500] of byte;
  264.    flen,len,i,j,pos,name_num: integer;
  265.    Event: word;
  266.    IP:string;
  267.    str_tp,str:string;
  268.    str_list_IP,str_list_name,str_list_disp,str_list_group,str_list_MAC:string;
  269.    StrTp:string;
  270. begin
  271.      flen:=sizeof(FSockAddrIn);
  272.      Event := WSAGetSelectEvent(Message.LParam);
  273.      if Event = FD_READ then
  274.      begin
  275.           len := recvfrom(sockfd, buffer, sizeof(buffer), 0, FSockAddrIn, flen);
  276.           if len> 0 then
  277.           begin
  278.             //FSockAddrIn.sin_addr.S_un_b.s_b1
  279.             with FSockAddrIn.sin_addr.S_un_b  do
  280.               IP:=format('%d.%d.%d.%d',[ord(s_b1),ord(s_b2),ord(s_b3),ord(s_b4)]);
  281.               str_list_IP:=IP;
  282.               //数据分析
  283.               name_num:=0;
  284.               str_tp:='';
  285.       for i:=1 to len do
  286.       begin
  287.         if((buffer[i]=$21)and(buffer[i+1]=$00)and(buffer[i+2]=$01)) then
  288.                 begin
  289.             name_num:=buffer[i+9];
  290.             break;
  291.         end;
  292.       end;
  293.       if name_num=0 then exit;
  294.       pos:=i+10;
  295.               str:='';
  296.       for i:=pos to (pos+18*name_num-1) do
  297.       begin
  298.          if (((i-pos)mod 18) =0) then
  299.          begin
  300.            for j:=0 to 14 do
  301.            begin
  302.              if trim(char(buffer[i+j]))='' then buffer[i+j]:=ord(' ');
  303.              str:=str+char(buffer[i+j]);
  304.            end;
  305.            if (buffer[i+16] and $80)=$80 then
  306.            begin
  307.                       if buffer[i+15]=$0 then str_list_GROUP:=trim(str);  //网络组
  308.               str:=str+format('<%x>',[buffer[i+15]]);
  309.       str:=str+'<GROUP>';
  310.    end
  311.    else begin
  312.                    if buffer[i+15]=$20 then str_list_name:=trim(str) //计算机名
  313.            else
  314.            if buffer[i+15]=$3 then str_list_disp:=trim(str);//计算机说明
  315.         str:=str+format('<%x>',[buffer[i+15]]);
  316.         str:=str+'<UNIQUE>';
  317.    end;
  318.     str_tp:=str_tp + str +#13+#10;
  319.     str:='';
  320.  end;
  321.       end;
  322.       for i:=0 to 5 do
  323.       begin
  324.           str:=str+format('%.2x.',[buffer[i+pos+18*name_num]]);
  325.       end;
  326.       delete(str,length(str),1);
  327.               str_list_MAC:=trim(str); //网卡的MAC码
  328.       str:='MAC:     '+str;
  329.               str_tp:=str_tp + str + #13+#10;
  330.               {网络信息}
  331.               //RxRedDispinf.Text :=RxRedDispinf.Text +IP +  #13+#10+  str_tp+ #13+#10;
  332.               {Grid}
  333.               list:=sgdispnetip.Items.Add;
  334.               list.Caption:=str_list_ip;  //'IP地址'
  335.               list.SubItems.Add(str_list_name);//'计算机名称'
  336.               list.SubItems.Add(str_list_GROUP);//'工作组名称'
  337.               list.SubItems.Add(str_list_MAC);//'Mac 地址'
  338.             {
  339.               I:=SgDispNetIP.Items.Count;
  340.               if I=2 then
  341.               begin
  342.                 if trim(SgDispNetIP.Items[1].Caption)<>'' then
  343.                  begin
  344.                     Inc(i);
  345.                     SgDispNetIP.RowCount:=I;
  346.                  end;
  347.               end
  348.               else begin
  349.                    Inc(i);
  350.                    SgDispNetIP.RowCount:=I;
  351.               end;
  352.               Dec(i);
  353.               SgDispNetIP.Cells[0,i]:=str_list_IP;//'TP地址'
  354.               SgDispNetIP.Cells[1,i]:=str_list_name;//'计算机名称'
  355.               SgDispNetIP.Cells[2,i]:=str_list_disp;//'计算机描述'
  356.               SgDispNetIP.Cells[3,i]:=str_list_GROUP;//'网络组'
  357.               SgDispNetIP.Cells[4,i]:=str_list_MAC;//'网卡MAC码'
  358.               }
  359.               {
  360.               RichEdit1.Text :=RichEdit1.Text + str_list_IP + ' ' + str_list_name + '  ' +
  361.               str_list_disp + '  ' + str_list_GROUP +'    '  + str_list_MAC+ #13+#10
  362.               }
  363.               setlength(TGroupNet,high(TGroupNet)+2);
  364.               TGroupNet[high(TGroupNet)].IP:=str_list_IP;//'TP地址'
  365.               TGroupNet[high(TGroupNet)].ComputerName :=str_list_name;//'计算机名称'
  366.               TGroupNet[high(TGroupNet)].ComputerDes:=str_list_disp;//'计算机描述'
  367.               TGroupNet[high(TGroupNet)].NetGroup:=str_list_GROUP;//'网络组'
  368.               TGroupNet[high(TGroupNet)].NetMacCode :=str_list_MAC;//'网卡MAC码'
  369.               StrTp:=str_list_IP + '   ' +str_list_name+ '   ' +
  370.                 str_list_disp + '   ' + str_list_GROUP + '   ' +
  371.                 str_list_MAC;
  372.               //RxRichEdit1.Lines.Add(StrTp);
  373.           end;
  374.           SetEvent(WAIT_ACK_EVENT);//有信号
  375.      end;
  376. end;
  377. {Grid清除 ClearGrid}
  378. procedure TSearchNetIp_frm.ClearGrid;
  379. begin
  380.    SgDispNetIP.Items.Clear;
  381. end;
  382.  
  383. {排序}
  384. {
  385. 'TP地址'0
  386. '计算机名称'1
  387. '计算机描述' 2
  388. '网络组'3
  389. '网卡MAC码'4
  390. }
  391. procedure TSearchNetIp_frm.MakeGrid(const IntIndex: integer=3);
  392. Var
  393.   X,XCount:integer;
  394.   GroupNet:TtGroupNet;
  395.   IntMin:integer;
  396.   list:Tlistitem;
  397.     Procedure GetMinTGroupNet();{获取最小TGroupNet}
  398.     Var
  399.        Y:integer;
  400.        NetMinIP, NetIP:integer;
  401.        DWxMin,DWx:Dword;
  402.        str_ip:string;       
  403.     begin
  404.        GroupNet:= tGroupNet[x] ;
  405.        IntMin:=x;
  406.        for Y:=x+1 to XCount do
  407.        begin
  408.          case Intindex of
  409.            0:begin //'TP地址'0
  410.                 NetMinIP:=inet_addr(PChar(GroupNet.IP)) ;  // 192.168.0.1 ===>01 00 A8 C0
  411.                 str_ip:=inttohex(NetMinIP,8);    //01 00 A8 C0
  412.                 str_ip:=copy(str_ip,7,2)+copy(str_ip,5,2)+copy(str_ip,3,2)+copy(str_ip,1,2);   //==> C0 A8 00 01
  413.                 DWxMin:=strtoint('$'+str_ip);   {转换成为一个长整形数}
  414.                 NetIP:=inet_addr(PChar(tGroupNet[y].IP)) ;  // 192.168.0.1 ===>01 00 A8 C0
  415.                 str_ip:=inttohex(NetIP,8);    //01 00 A8 C0
  416.                 str_ip:=copy(str_ip,7,2)+copy(str_ip,5,2)+copy(str_ip,3,2)+copy(str_ip,1,2);   //==> C0 A8 00 01
  417.                 DWx:=strtoint('$'+str_ip);   {转换成为一个长整形数}
  418.                 if DWxMin> DWx then
  419. //                if inet_addr(PChar(GroupNet.IP))> inet_addr(PChar(tGroupNet[y].IP)) then
  420.                 begin
  421.                   IntMin:=y;
  422.                   GroupNet:=tGroupNet[IntMin];
  423.                 end;
  424.              end;
  425.            1:begin //'计算机名称'1
  426.                 if GroupNet.ComputerName > tGroupNet[y].ComputerName then
  427.                 begin
  428.                   IntMin:=y;
  429.                   GroupNet:=tGroupNet[IntMin];
  430.                 end;
  431.              end;
  432.            2:begin //'计算机描述' 2
  433.                 if GroupNet.ComputerDes > tGroupNet[y].ComputerDes then
  434.                 begin
  435.                   IntMin:=y;
  436.                   GroupNet:=tGroupNet[IntMin];
  437.                 end;
  438.              end;
  439.            3:begin //'网络组'3
  440.                 if GroupNet.NetGroup > tGroupNet[y].NetGroup then
  441.                 begin
  442.                   IntMin:=y;
  443.                   GroupNet:=tGroupNet[IntMin];
  444.                 end;
  445.              end;
  446.            4:begin //'网卡MAC码'4
  447.                 if GroupNet.NetMacCode > tGroupNet[y].NetMacCode then
  448.                 begin
  449.                   IntMin:=y;
  450.                   GroupNet:=tGroupNet[IntMin];
  451.                 end;
  452.              end;
  453.          end;{case}
  454.        end;{For}
  455.     end;
  456.     Procedure MakeGrid();{重写Grid}
  457.     Var
  458.       Y:integer;
  459.       StrTp:string;
  460.     begin
  461.        //SgDispNetIP.RowCount:=Xcount+2;
  462.        //RxRichEdit1.Text :='';
  463.        StrTp:='';
  464.        For y:=0 to Xcount do
  465.        begin
  466.           list:=sgdispnetip.Items.Add;
  467.           list.Caption:=TGroupNet[y].IP;  //'IP地址'
  468.           list.SubItems.Add(tGroupNet[y].ComputerName);//'计算机名称'
  469.           list.SubItems.Add(tGroupNet[y].NetGroup);//'工作组名称'
  470.           list.SubItems.Add(tGroupNet[y].NetMacCode);//'Mac 地址'
  471.          StrTp:=TGroupNet[y].IP + '   ' +tGroupNet[y].ComputerName+ '   ' +
  472.                 tGroupNet[y].ComputerDes + '   ' + tGroupNet[y].NetGroup + '   ' +
  473.                 tGroupNet[y].NetMacCode;
  474.          //RxRichEdit1.Lines.Add(StrTp);
  475.        end;{for}
  476.     end;
  477. begin
  478.     XCount:=high(TGroupNet);
  479.     if XCount<0 then exit;
  480.     {清除Grid}
  481.     ClearGrid;
  482.     for x:=0 to XCount do
  483.     begin
  484.         GetMinTGroupNet();
  485.         if x<>IntMin then
  486.         begin
  487.            GroupNet:=TGroupNet[x];
  488.            TGroupNet[x]:=TGroupNet[IntMin];
  489.            TGroupNet[IntMin]:=GroupNet;
  490.         end;
  491.     end;{for}
  492.     MakeGrid();{重写Grid}
  493. end;
  494. procedure TSearchNetIp_frm.SgDispNetIPSelectCell(Sender: TObject; ACol,
  495.   ARow: Integer; var CanSelect: Boolean);
  496. begin
  497.     IntGridCol:=ACol;
  498. end;
  499. procedure TSearchNetIp_frm.SgDispNetIPDblClick(Sender: TObject);
  500. begin
  501.    MakeGrid(IntGridCol);
  502. end;
  503. procedure TSearchNetIp_frm.RxSEdDelayKeyPress(Sender: TObject;
  504.   var Key: Char);
  505. begin
  506.       if key=#13 then
  507.          SBrnScanNetIPClick(nil);
  508. end;
  509. end.