当我的程式正在运行一个FOR循环的时候,单击了关闭按钮,则程式会在执行关闭命令以后,继续执行未完成的FOR循环,这样就会造成读地址之类的错误,而且程式也无法关闭了.该怎么解决这种问题呢?急...
解决方案 »
- 专家些咨询一下
- TDataSetProvider.GetRecords如何取出XML记录集
- 谁有InterBase的资料??
- 用NMSMTP做MAIL时,怎样根据邮箱名得到它的SMTP服务器名称啊?欢迎光临!!
- 请问要怎么办才能避免TPaintBox不闪耀?
- 应用程序服务器连接数量限制!!!!!!!!!!!
- 如何将int64写入tstream,并从tstream中读取?
- 怎样判断一个动态控件变量是否已生成?
- 有关Treeview的Items问题,
- 请问在delphi中如何实现与return类似的功能?
- 用什么好的方法能打印出如下的表格?
- 如何制作一个多项查询,就是在dbgrid里可以有下拉单选择的,并可以自己增加
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
while true do
begin
application.ProcessMessages;
if tag=1 then break;
end;
end;procedure TForm1.BitBtn2Click(Sender: TObject);
begin
tag:=1;
close;
end;
begin
while true do
begin
application.ProcessMessages;
if tag=1 then break;
end;
end;procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
tag:=1;
end;
begin
if ComportNo<>'' then
Begin
TempCom:=Comportno;
end else
begin
TempCom:=reg.ReadString(ts.Strings [i]);
end;
Label7.Caption :='初始化串口...'; if not TCDMA1.ComPortInit(strtoint(copy(TempCom,4,length(TempCom)-3)),BaudRate) then
begin
//TCDMA1.ComPortInit(strtoint(copy(TempCom,4,length(TempCom)-3)),BaudRate);
TCDMA1.ComPortFree ;
Label7.Caption :='初始化串口失败';
flag:=False;
continue;
end; Label7.Caption :='检查串口通讯...';
if not TCDMA1.AT_SendAT_WithCheck then
begin
TCDMA1.ComPortFree ;
Label7.Caption :='串口通讯失败';
flag:=False;
continue;
end; Label7.Caption :='正在检查UIM卡...';
Label7.Caption :=TCDMA1.ReadRUIMStatus('FX') ;
if Label7.Caption<>'UIM卡状态正常' then
begin
Label7.Caption:=TCDMA1.ReadRUIMStatus('HT');
if Label7.Caption<>'UIM卡状态正常' then
begin
TCDMA1.ComPortFree ;
flag:=False;
sleep(100);
continue;
end else
begin
ComportNo:=TempCom;
VersionFlag:='HT';
end;
end else
begin
ComportNo:=TempCom;
VersionFlag:='FX';
end;
if Label7.Caption <>'UIM卡状态正常' then
begin
TCDMA1.ComPortFree ;
flag:=False;
sleep(100);
continue;
end else
begin
openstatus:=true;
flag:=true;
break;
end;
end;
begin
-----------------这里加一个就可以了,你加那么多干什么