向高手们求教了:
1.如何启用WINDOWS自带的IP地址输入栏的控件?
2.如何进行快速扫描IP,确定该机器是否在网络上.哪位好心的能给我源代码,100分全给了,嫌不够就再加.

解决方案 »

  1.   

    windows自带的ip控件你是指下面的这个吧
    var 
      ipEdit:hwnd;initcommoncontrol(icc_internet_class);
    ipedit := createwindow(wc_ipaddress,nil,ws_child or ws_visible,10,50,130,23,self.Handle,0,Hinstance,nil);如果要做扫描程序
    直接用原始套接字编程
      connect(sock,sockaddr,sizeof(sockaddr));
    不过要做ip段扫描还要注意用多线程
      

  2.   

    ImgScan.FileType := 3;
        ImgScan.ScanTo   := 1;procedure TFormImport.tbtnScanClick(Sender: TObject);
    var ScanFile,jpgFile: String;
        bmp: TBitmap;
        jpg: TJpegImage;
        LS: TListItem;
    begin
    try
      ForceDirectories(FilePath);
      if TRIM(edtScanFile.Text) = '' then
      begin
        Application.MessageBox('请输入扫描的文件名!','系统提示',MB_OK+MB_IconInformation);
        edtScanFile.SetFocus;
        Exit;
      end;
      if FileExists(FilePath+'\'+edtScanFile.Text) then
      begin
        if Application.MessageBox('该文件已经存在,是否覆盖?','系统提示',MB_YESNO+MB_IconQuestion+MB_DEFButton2) = IDNO then
        begin
          edtScanFile.SetFocus;
          Exit;
        end;  
      end;
    //  ImgEdit.Visible := True;
      ImgScan.ShowSelectScanner;
      //如果选择的扫描仪不可用
      if  not ImgScan.ScannerAvailable then
        ImgScan.OpenScanner;  //打开扫描仪
      ImgScan.Image := FilePath+ '\'+ TRIM(edtScanFile.Text) + '.bmp';
      ImgScan.StartScan;    //开始扫描图象
      ImgScan.CloseScanner; //关闭扫描仪
      //
      ScanFile := FilePath+ '\'+ TRIM(edtScanFile.Text) + '.bmp';
      //转换Bmp文件到Jpg
      try
        bmp := TBitmap.Create;
        jpg := TJpegImage.Create;
        bmp.LoadFromFile(ScanFile);
        jpg.Assign(bmp);
        jpgFile := ChangeFileExt(ScanFile,'.jpg');
        jpg.SaveToFile(jpgFile);
        bmp.Free;
        jpg.Free;
        DeleteFile(ScanFile);
      except
        Application.MessageBox('转换图片失败,请缩小扫描精度!','系统提示',MB_OK+MB_IconError);
        Exit;
      end;
    except
      Application.MessageBox('扫描图象出错,请重新扫描!','错误',MB_OK+MB_IconError);
    end;
    end;