得到网络邻居所有的机器名的程序,我不能通过 ,大家帮我看看,问题是什么,衷心的感谢了,问题有两个,一个出现在delspace那里,是undeclared identifier,要声明吗?具体怎么声明呢? 第二个是,不能打开c; ~~.txt,其他还有没有问题,不知道,请大家帮帮忙吧,程序如下:(其实也是从网上找下来的^_^!)
unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;type
  TForm1 = class(TForm)
    Timer1: TTimer;
    Memo1: TMemo;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
  command:string ;
  comline: pchar ;
begin
  command:='COMMAND.COM /C net view>c: ~~.txt';
  comline:=pchar(command);
  WinExec(comline, sw_hide);
  timer1.Enabled:=true;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
  f:tstringlist;
  ll,ii:integer;
  s1,s:string;
  b:bool;
begin
  f:=tstringlist.Create;
  try
  f.LoadFromFile('c: ~~.txt');
  except
  end;
  if f.Count>10 then
  begin
    memo1.Clear;
    memo1.lines.add(f.text);
    timer1.Enabled:=false;
    f.Free;
    //去掉多余的行和'\'
    for ll:=memo1.lines.count-1 downto 0 do
    begin
      if strpos(pchar(memo1.lines.strings[ll]),'\')=nil then
        memo1.lines.delete(ll)
      else   memo1.lines.Strings[ll]:=delspace(memo1.lines.Strings[ll]);    end;
  timer1.enabled:=False;
end;
           end;end.

解决方案 »

  1.   

    1、delspace改为Trim
    2、你是不是就会抄代码,一点都不知道改改么,c: ~~.txt根本就不是一个有效的文件名啊————————————————————————————————————
    宠辱不惊,看庭前花开花落,去留无意;毁誉由人,望天上云卷云舒,聚散任风。
    ————————————————————————————————————
      

  2.   

    呵呵,那你告诉我c: ~~.txt要改成什么啊,我本来就是刚刚才接触嘛