P
pfpf0365
Unregistered / Unconfirmed
GUEST, unregistred user!
请问下面的源程序为什么运行不过去,老是出现错误? 谢谢大家?
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Psock, NMHttp, StdCtrls, Buttons, ComCtrls, ExtCtrls;
type
TForm1 = class(TForm)
NMHTTP1: TNMHTTP;
GroupBox1: TGroupBox;
Memo1: TMemo;
SaveDialog1: TSaveDialog;
StatusBar1: TStatusBar;
Panel1: TPanel;
Panel2: TPanel;
GroupBox2: TGroupBox;
RadioChina: TRadioButton;
RadioInter: TRadioButton;
GroupBox3: TGroupBox;
RadioNight: TRadioButton;
RadioMorning: TRadioButton;
Panel3: TPanel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
procedure Button1Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
Content,Content1,contentTitle,MixTemperture,MaxTemperture,TempTemperture:string;
StrOldCity,strnewCity: array[1..33] of string;
StrCity,StrTemp:string;
i,j:integer;
begin
Screen.Cursor:=crHourGlass;
StatusBar1.Panels[0].Text:='正在下载天气信息,请等候........';
memo1.text:='';
if RadioChina.checked then
begin
StrOldCity[1]:='上海市';
StrOldCity[2]:='天津市';
StrOldCity[3]:='重庆市';
StrOldCity[4]:='长春市';
StrOldCity[5]:='沈阳市';
StrOldCity[6]:='哈尔滨市';
StrOldCity[7]:='石家庄市';
StrOldCity[8]:='太原市';
StrOldCity[9]:='济南市';
StrOldCity[10]:='合肥市';
StrOldCity[11]:='南京市';
StrOldCity[12]:='杭州市';
StrOldCity[13]:='南昌市';
StrOldCity[14]:='福州市';
StrOldCity[15]:='郑州市';
StrOldCity[16]:='武汉市';
StrOldCity[17]:='长沙市';
StrOldCity[18]:='广州市';
StrOldCity[19]:='海口市';
StrOldCity[20]:='香港';
StrOldCity[21]:='西安市';
StrOldCity[22]:='兰州市';
StrOldCity[23]:='西宁市';
StrOldCity[24]:='银川市';
StrOldCity[25]:='乌鲁木齐市';
StrOldCity[26]:='昆明市';
StrOldCity[27]:='拉萨市';
StrOldCity[28]:='成都市';
StrOldCity[29]:='南宁市';
StrOldCity[30]:='贵阳市';
StrOldCity[31]:='呼和浩特市';
StrOldCity[32]:='台北市';
StrOldCity[33]:='澳门';
end;
if RadioInter.Checked then
begin
StrOldCity[1]:='东京';
StrOldCity[2]:='曼谷';
StrOldCity[3]:='卡拉奇';
StrOldCity[4]:='法兰克福';
StrOldCity[5]:='莫斯科';
StrOldCity[6]:='开罗';
StrOldCity[7]:='巴黎';
StrOldCity[8]:='伦敦';
StrOldCity[9]:='悉尼';
StrOldCity[10]:='纽约';
end;
try
if ((RadioChina.Checked ) and (RadioMorning.checked)) then
//国内早间天气预报
begin
Content1:='';
NMHTTP1.get('http://www.grmc.gov.cn/fct/inland.htm');
Content:=Nmhttp1.Body;
Content:=Copy(content,Pos('气温',content),length(Content));
ContentTitle:=FormatDateTime('mm"月"dd"日早8时"',now+1);
ContentTitle:=ContentTitle+FormatDateTime('"至"mm"月"dd"日早8时"',now+2);
Content:=Copy(Content,Pos('</TR>',Content)+5,length(Content));
Content:=Copy(Content,Pos('<TR>',Content)+4,length(Content));
while Pos('<TD>',content)>0 do
begin
Content1:='';
Content:=Copy(Content,Pos('<TD>',Content)+5,length(Content));
content1:=Content1+trim(Copy(Content,Pos('>',Content)+1,Pos('</',content)-Pos('>',Content)-1));
Strcity:=trim(Content1);
Content1:='天气预报'+#13#10+ContentTitle+',';
///天气状况
Content:=Copy(Content,Pos('<TD>',Content)+1,length(Content));
content1:=Content1+trim(Copy(Content,Pos('>',Content)+1,Pos('</',content)-Pos('>',Content)-1))+',';
Content:=Copy(Content,Pos('<TD>',Content)+1,length(Content));
TempTemperture:=Copy(Content,Pos('>',Content)+1,Pos('</',Content)-Pos('>',Content)-1);
MixTemperture:='';
MaxTemperture:='';
if Pos('--',TempTemperture)>0 then
begin
//MixTemperture:='最低气温'+trim(Copy(TempTemperture,1,Pos('--',TempTemperture)-1))+',';
MaxTemperture:='最高气温'+trim(Copy(TempTemperture,Pos('--',TempTemperture)+2,length(TempTemperture)))+',';
end else MaxTemperture:=trim(Copy(Content,Pos('>',Content)+1,Pos('</',content)-Pos('>',Content)-1))+',';
Content:=Copy(Content,Pos('<TD>',Content)+1,length(Content));
Content:=Copy(Content,Pos('<TD>',Content)+1,length(Content));
TempTemperture:=Copy(Content,Pos('>',Content)+1,Pos('</',Content)-Pos('>',Content)-1);
if Pos('--',TempTemperture)>0 then
begin
MixTemperture:='最低气温'+trim(Copy(TempTemperture,1,Pos('--',TempTemperture)-1))+',';
//MaxTemperture:='最高气温'+trim(Copy(TempTemperture,Pos('--',TempTemperture)+2,length(TempTemperture)))+',';
end else MixTemperture:=trim(Copy(Content,Pos('>',Content)+1,Pos('</',content)-Pos('>',Content)-1))+',';
content1:=Content1+MaxTemperture+MixTemperture ;
Content1:=Content1+'风力1-2级'+#13#10+#13#10+#13#10;
For i:=1 to 33 do
if Pos(StrCity,strOldCity)>0 then StrNewCity:=strOldCity+Content1;
end;
end;
if ((RadioChina.Checked ) and (RadioNight.checked)) then
//国内晚间天气预报
begin
Content1:='';
NMHTTP1.get('http://www.grmc.gov.cn/fct/inland.htm');
Content:=Nmhttp1.Body;
Content:=Copy(content,Pos('气温',content),length(Content));
ContentTitle:=FormatDateTime('mm"月"dd"日20时至"',now);
ContentTitle:=ContentTitle+FormatDateTime('mm"月"dd"日20时"',now+1);
Content:=Copy(Content,Pos('</TR>',Content)+5,length(Content));
Content:=Copy(Content,Pos('<TR>',Content)+4,length(Content));
while Pos('<TD>',content)>0 do
begin
Content1:='';
Content:=Copy(Content,Pos('<TD>',Content)+5,length(Content));
content1:=Content1+trim(Copy(Content,Pos('>',Content)+1,Pos('</',content)-Pos('>',Content)-1));
Strcity:=trim(Content1);
Content1:='市天气预报'+#13#10+ContentTitle+',';
///天气状况
Content:=Copy(Content,Pos('<TD>',Content)+1,length(Content));
content1:=Content1+trim(Copy(Content,Pos('>',Content)+1,Pos('</',content)-Pos('>',Content)-1))+',';
Content:=Copy(Content,Pos('<TD>',Content)+1,length(Content));
TempTemperture:=Copy(Content,Pos('>',Content)+1,Pos('</',Content)-Pos('>',Content)-1);
MixTemperture:='';
MaxTemperture:='';
if Pos('--',TempTemperture)>0 then
begin
MixTemperture:='最低气温'+trim(Copy(TempTemperture,1,Pos('--',TempTemperture)-1))+',';
MaxTemperture:='最高气温'+trim(Copy(TempTemperture,Pos('--',TempTemperture)+2,length(TempTemperture)))+',';
//content1:=Content1+MixTemperture+'最高气温'+trim(Copy(TempTemperture,Pos('--',TempTemperture)+2,length(TempTemperture)))+',';
end else TempTemperture:=trim(Copy(Content,Pos('>',Content)+1,Pos('</',content)-Pos('>',Content)-1))+',';
if not RadioNight.Checked then
content1:=Content1+MaxTemperture+MixTemperture
else
content1:=Content1+MixTemperture+MaxTemperture;
Content1:=Content1+'风力1-2级'+#13#10+#13#10+#13#10;
For i:=1 to 33 do
if Pos(StrCity,strOldCity)>0 then StrNewCity:=strOldCity+Content1;
Content:=Copy(Content,Pos('<TD>',Content)+1,length(Content));
Content:=Copy(Content,Pos('<TD>',Content)+1,length(Content));
end;
end;
if RadioInter.Checked then
//国际早间天气预报
begin
Content1:='';
NMHTTP1.get('http://www.grmc.gov.cn/fct/inter.htm');
Content:=Nmhttp1.Body;
Content:=Copy(content,Pos('气温',content),length(Content));
if Radionight.checked then ContentTitle:=FormatDateTime('mm"月"dd"日"',now)
else ContentTitle:=FormatDateTime('mm"月"dd"日"',now+1);
Content:=Copy(Content,Pos('<tr>',Content)+5,length(Content));
while Pos('<TD>',content)>0 do
begin
Content1:='';
Content:=Copy(Content,Pos('<TD>',Content)+5,length(Content));
content1:=Content1+trim(Copy(Content,Pos('>',Content)+1,Pos('</',content)-Pos('>',Content)-1));
Strcity:=trim(Content1);
Content1:=Content1+'天气预报'+#13#10+ContentTitle+',';
///天气状况
Content:=Copy(Content,Pos('<TD>',Content)+1,length(Content));
content1:=Content1+trim(Copy(Content,Pos('>',Content)+1,Pos('</',content)-Pos('>',Content)-1))+',';
Content:=Copy(Content,Pos('<TD>',Content)+1,length(Content));
TempTemperture:=Copy(Content,Pos('>',Content)+1,Pos('</',Content)-Pos('>',Content)-1);
MixTemperture:='';
MaxTemperture:='';
if Pos('--',TempTemperture)>0 then
begin
MixTemperture:='最低气温'+trim(Copy(TempTemperture,1,Pos('--',TempTemperture)-1))+',';
MaxTemperture:='最高气温'+trim(Copy(TempTemperture,Pos('--',TempTemperture)+2,length(TempTemperture)))+',';
//content1:=Content1+MixTemperture+'最高气温'+trim(Copy(TempTemperture,Pos('--',TempTemperture)+2,length(TempTemperture)))+',';
end else TempTemperture:=trim(Copy(Content,Pos('>',Content)+1,Pos('</',content)-Pos('>',Content)-1))+',';
if not RadioNight.Checked then
content1:=Content1+MaxTemperture+MixTemperture
else
content1:=Content1+MixTemperture+MaxTemperture;
Content1:=Content1+'风力1-2级'+#13#10+#13#10+#13#10;
For i:=1 to 10 do
if Pos(strOldCity,StrCity)>0 then StrNewCity:=Content1;
end;
end;
except
showmessage('不能连接网站,请检查网络是上网!');
StatusBar1.Panels[0].Text:='';
Screen.Cursor:=crDefault;
end;
Content1:='';
Content:='';
j:=0;
For i:=1 to 33 do
begin
if StrNewCity<>'' then
j:=j+1
else Content:=Content+StroldCity+',';
Content1:=Content1+StrNewCity;
end;
memo1.text:=#13#10+trim(Content1);
Content:=Copy(Content,1,length(Content)-1);
StatusBar1.Panels[0].Text:='下载完毕!';
StatusBar1.Panels[1].Text:='共下载城市天气情况:'+inttostr(j);
if Content<>',,,,,,,,,,,,,,,,,,,,,,' then StatusBar1.Panels[2].Text:='缺少下载城市为:'+Content;
Screen.Cursor:=crDefault;
end;
procedure TForm1.BitBtn3Click(Sender: TObject);
begin
close;
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
var
f:textfile;
i:integer;
begin
if SaveDialog1.Execute then
begin
if FileExists(SaveDialog1.FileName) then
if Application.MessageBox('已有此文件,你要替换吗?','提示',
MB_OKCANCEL + MB_DEFBUTTON1) = IDOK then deletefile(SaveDialog1.FileName);
AssignFile(f,SaveDialog1.FileName);
Rewrite(f);
Writeln(f,'');
for i:=0 to Memo1.lines.count-1 do
Writeln(f,trim(Memo1.lines));
CloseFile(f);
end;
end;
end.
我刚学习delphi。请告诉我为什么?
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Psock, NMHttp, StdCtrls, Buttons, ComCtrls, ExtCtrls;
type
TForm1 = class(TForm)
NMHTTP1: TNMHTTP;
GroupBox1: TGroupBox;
Memo1: TMemo;
SaveDialog1: TSaveDialog;
StatusBar1: TStatusBar;
Panel1: TPanel;
Panel2: TPanel;
GroupBox2: TGroupBox;
RadioChina: TRadioButton;
RadioInter: TRadioButton;
GroupBox3: TGroupBox;
RadioNight: TRadioButton;
RadioMorning: TRadioButton;
Panel3: TPanel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
procedure Button1Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
Content,Content1,contentTitle,MixTemperture,MaxTemperture,TempTemperture:string;
StrOldCity,strnewCity: array[1..33] of string;
StrCity,StrTemp:string;
i,j:integer;
begin
Screen.Cursor:=crHourGlass;
StatusBar1.Panels[0].Text:='正在下载天气信息,请等候........';
memo1.text:='';
if RadioChina.checked then
begin
StrOldCity[1]:='上海市';
StrOldCity[2]:='天津市';
StrOldCity[3]:='重庆市';
StrOldCity[4]:='长春市';
StrOldCity[5]:='沈阳市';
StrOldCity[6]:='哈尔滨市';
StrOldCity[7]:='石家庄市';
StrOldCity[8]:='太原市';
StrOldCity[9]:='济南市';
StrOldCity[10]:='合肥市';
StrOldCity[11]:='南京市';
StrOldCity[12]:='杭州市';
StrOldCity[13]:='南昌市';
StrOldCity[14]:='福州市';
StrOldCity[15]:='郑州市';
StrOldCity[16]:='武汉市';
StrOldCity[17]:='长沙市';
StrOldCity[18]:='广州市';
StrOldCity[19]:='海口市';
StrOldCity[20]:='香港';
StrOldCity[21]:='西安市';
StrOldCity[22]:='兰州市';
StrOldCity[23]:='西宁市';
StrOldCity[24]:='银川市';
StrOldCity[25]:='乌鲁木齐市';
StrOldCity[26]:='昆明市';
StrOldCity[27]:='拉萨市';
StrOldCity[28]:='成都市';
StrOldCity[29]:='南宁市';
StrOldCity[30]:='贵阳市';
StrOldCity[31]:='呼和浩特市';
StrOldCity[32]:='台北市';
StrOldCity[33]:='澳门';
end;
if RadioInter.Checked then
begin
StrOldCity[1]:='东京';
StrOldCity[2]:='曼谷';
StrOldCity[3]:='卡拉奇';
StrOldCity[4]:='法兰克福';
StrOldCity[5]:='莫斯科';
StrOldCity[6]:='开罗';
StrOldCity[7]:='巴黎';
StrOldCity[8]:='伦敦';
StrOldCity[9]:='悉尼';
StrOldCity[10]:='纽约';
end;
try
if ((RadioChina.Checked ) and (RadioMorning.checked)) then
//国内早间天气预报
begin
Content1:='';
NMHTTP1.get('http://www.grmc.gov.cn/fct/inland.htm');
Content:=Nmhttp1.Body;
Content:=Copy(content,Pos('气温',content),length(Content));
ContentTitle:=FormatDateTime('mm"月"dd"日早8时"',now+1);
ContentTitle:=ContentTitle+FormatDateTime('"至"mm"月"dd"日早8时"',now+2);
Content:=Copy(Content,Pos('</TR>',Content)+5,length(Content));
Content:=Copy(Content,Pos('<TR>',Content)+4,length(Content));
while Pos('<TD>',content)>0 do
begin
Content1:='';
Content:=Copy(Content,Pos('<TD>',Content)+5,length(Content));
content1:=Content1+trim(Copy(Content,Pos('>',Content)+1,Pos('</',content)-Pos('>',Content)-1));
Strcity:=trim(Content1);
Content1:='天气预报'+#13#10+ContentTitle+',';
///天气状况
Content:=Copy(Content,Pos('<TD>',Content)+1,length(Content));
content1:=Content1+trim(Copy(Content,Pos('>',Content)+1,Pos('</',content)-Pos('>',Content)-1))+',';
Content:=Copy(Content,Pos('<TD>',Content)+1,length(Content));
TempTemperture:=Copy(Content,Pos('>',Content)+1,Pos('</',Content)-Pos('>',Content)-1);
MixTemperture:='';
MaxTemperture:='';
if Pos('--',TempTemperture)>0 then
begin
//MixTemperture:='最低气温'+trim(Copy(TempTemperture,1,Pos('--',TempTemperture)-1))+',';
MaxTemperture:='最高气温'+trim(Copy(TempTemperture,Pos('--',TempTemperture)+2,length(TempTemperture)))+',';
end else MaxTemperture:=trim(Copy(Content,Pos('>',Content)+1,Pos('</',content)-Pos('>',Content)-1))+',';
Content:=Copy(Content,Pos('<TD>',Content)+1,length(Content));
Content:=Copy(Content,Pos('<TD>',Content)+1,length(Content));
TempTemperture:=Copy(Content,Pos('>',Content)+1,Pos('</',Content)-Pos('>',Content)-1);
if Pos('--',TempTemperture)>0 then
begin
MixTemperture:='最低气温'+trim(Copy(TempTemperture,1,Pos('--',TempTemperture)-1))+',';
//MaxTemperture:='最高气温'+trim(Copy(TempTemperture,Pos('--',TempTemperture)+2,length(TempTemperture)))+',';
end else MixTemperture:=trim(Copy(Content,Pos('>',Content)+1,Pos('</',content)-Pos('>',Content)-1))+',';
content1:=Content1+MaxTemperture+MixTemperture ;
Content1:=Content1+'风力1-2级'+#13#10+#13#10+#13#10;
For i:=1 to 33 do
if Pos(StrCity,strOldCity)>0 then StrNewCity:=strOldCity+Content1;
end;
end;
if ((RadioChina.Checked ) and (RadioNight.checked)) then
//国内晚间天气预报
begin
Content1:='';
NMHTTP1.get('http://www.grmc.gov.cn/fct/inland.htm');
Content:=Nmhttp1.Body;
Content:=Copy(content,Pos('气温',content),length(Content));
ContentTitle:=FormatDateTime('mm"月"dd"日20时至"',now);
ContentTitle:=ContentTitle+FormatDateTime('mm"月"dd"日20时"',now+1);
Content:=Copy(Content,Pos('</TR>',Content)+5,length(Content));
Content:=Copy(Content,Pos('<TR>',Content)+4,length(Content));
while Pos('<TD>',content)>0 do
begin
Content1:='';
Content:=Copy(Content,Pos('<TD>',Content)+5,length(Content));
content1:=Content1+trim(Copy(Content,Pos('>',Content)+1,Pos('</',content)-Pos('>',Content)-1));
Strcity:=trim(Content1);
Content1:='市天气预报'+#13#10+ContentTitle+',';
///天气状况
Content:=Copy(Content,Pos('<TD>',Content)+1,length(Content));
content1:=Content1+trim(Copy(Content,Pos('>',Content)+1,Pos('</',content)-Pos('>',Content)-1))+',';
Content:=Copy(Content,Pos('<TD>',Content)+1,length(Content));
TempTemperture:=Copy(Content,Pos('>',Content)+1,Pos('</',Content)-Pos('>',Content)-1);
MixTemperture:='';
MaxTemperture:='';
if Pos('--',TempTemperture)>0 then
begin
MixTemperture:='最低气温'+trim(Copy(TempTemperture,1,Pos('--',TempTemperture)-1))+',';
MaxTemperture:='最高气温'+trim(Copy(TempTemperture,Pos('--',TempTemperture)+2,length(TempTemperture)))+',';
//content1:=Content1+MixTemperture+'最高气温'+trim(Copy(TempTemperture,Pos('--',TempTemperture)+2,length(TempTemperture)))+',';
end else TempTemperture:=trim(Copy(Content,Pos('>',Content)+1,Pos('</',content)-Pos('>',Content)-1))+',';
if not RadioNight.Checked then
content1:=Content1+MaxTemperture+MixTemperture
else
content1:=Content1+MixTemperture+MaxTemperture;
Content1:=Content1+'风力1-2级'+#13#10+#13#10+#13#10;
For i:=1 to 33 do
if Pos(StrCity,strOldCity)>0 then StrNewCity:=strOldCity+Content1;
Content:=Copy(Content,Pos('<TD>',Content)+1,length(Content));
Content:=Copy(Content,Pos('<TD>',Content)+1,length(Content));
end;
end;
if RadioInter.Checked then
//国际早间天气预报
begin
Content1:='';
NMHTTP1.get('http://www.grmc.gov.cn/fct/inter.htm');
Content:=Nmhttp1.Body;
Content:=Copy(content,Pos('气温',content),length(Content));
if Radionight.checked then ContentTitle:=FormatDateTime('mm"月"dd"日"',now)
else ContentTitle:=FormatDateTime('mm"月"dd"日"',now+1);
Content:=Copy(Content,Pos('<tr>',Content)+5,length(Content));
while Pos('<TD>',content)>0 do
begin
Content1:='';
Content:=Copy(Content,Pos('<TD>',Content)+5,length(Content));
content1:=Content1+trim(Copy(Content,Pos('>',Content)+1,Pos('</',content)-Pos('>',Content)-1));
Strcity:=trim(Content1);
Content1:=Content1+'天气预报'+#13#10+ContentTitle+',';
///天气状况
Content:=Copy(Content,Pos('<TD>',Content)+1,length(Content));
content1:=Content1+trim(Copy(Content,Pos('>',Content)+1,Pos('</',content)-Pos('>',Content)-1))+',';
Content:=Copy(Content,Pos('<TD>',Content)+1,length(Content));
TempTemperture:=Copy(Content,Pos('>',Content)+1,Pos('</',Content)-Pos('>',Content)-1);
MixTemperture:='';
MaxTemperture:='';
if Pos('--',TempTemperture)>0 then
begin
MixTemperture:='最低气温'+trim(Copy(TempTemperture,1,Pos('--',TempTemperture)-1))+',';
MaxTemperture:='最高气温'+trim(Copy(TempTemperture,Pos('--',TempTemperture)+2,length(TempTemperture)))+',';
//content1:=Content1+MixTemperture+'最高气温'+trim(Copy(TempTemperture,Pos('--',TempTemperture)+2,length(TempTemperture)))+',';
end else TempTemperture:=trim(Copy(Content,Pos('>',Content)+1,Pos('</',content)-Pos('>',Content)-1))+',';
if not RadioNight.Checked then
content1:=Content1+MaxTemperture+MixTemperture
else
content1:=Content1+MixTemperture+MaxTemperture;
Content1:=Content1+'风力1-2级'+#13#10+#13#10+#13#10;
For i:=1 to 10 do
if Pos(strOldCity,StrCity)>0 then StrNewCity:=Content1;
end;
end;
except
showmessage('不能连接网站,请检查网络是上网!');
StatusBar1.Panels[0].Text:='';
Screen.Cursor:=crDefault;
end;
Content1:='';
Content:='';
j:=0;
For i:=1 to 33 do
begin
if StrNewCity<>'' then
j:=j+1
else Content:=Content+StroldCity+',';
Content1:=Content1+StrNewCity;
end;
memo1.text:=#13#10+trim(Content1);
Content:=Copy(Content,1,length(Content)-1);
StatusBar1.Panels[0].Text:='下载完毕!';
StatusBar1.Panels[1].Text:='共下载城市天气情况:'+inttostr(j);
if Content<>',,,,,,,,,,,,,,,,,,,,,,' then StatusBar1.Panels[2].Text:='缺少下载城市为:'+Content;
Screen.Cursor:=crDefault;
end;
procedure TForm1.BitBtn3Click(Sender: TObject);
begin
close;
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
var
f:textfile;
i:integer;
begin
if SaveDialog1.Execute then
begin
if FileExists(SaveDialog1.FileName) then
if Application.MessageBox('已有此文件,你要替换吗?','提示',
MB_OKCANCEL + MB_DEFBUTTON1) = IDOK then deletefile(SaveDialog1.FileName);
AssignFile(f,SaveDialog1.FileName);
Rewrite(f);
Writeln(f,'');
for i:=0 to Memo1.lines.count-1 do
Writeln(f,trim(Memo1.lines));
CloseFile(f);
end;
end;
end.
我刚学习delphi。请告诉我为什么?