안녕하세요.....
델파이 초보입니다....
오늘도 역시 델파이와 열심히 사귀고 있습니다...
그런데 제가 만든 프로그램에서 종료를 하면 꼭 10번중에 세번정도 에러내지 종료가 안되거든요... 미치고 환장할 노릇입니다..
물론 제 실력이 미천하다 보니 그런 일이.....^^;
그래서 하다하다 이렇게 글을 올립니다..
제 소스입니다...
쓰레드는 이렇게 정의 하였구요.....
unit dBackDown;
interface
uses
  Classes,Sysutils,Windows,ZipMstr,Forms,Inifiles,Dialogs;
type
  TDownLoad = class(TThread)
  private
      { Private declarations }
  protected
    procedure Execute; override;
  public
    constructor Create;
  end;
implementation
uses
  dFunc;
const
  UrlConfig= 'http://www...../';
  UrlDown = 'Http://www.....';
  UrlDownApp = 'Http://www....';
  VerCheck : Boolean = False;
constructor TDownLoad.Create;
begin
  FreeOnTerminate := True;
  inherited Create(False);
end;
procedure GetCate2List;
begin
......
end;
procedure GetsearchList;
begin
.......
end;
procedure GetStateList;
begin
......
end;
procedure Get911List;
begin
  ........
end;
                                   
procedure GetFrontList;
begin
  ........
end;
procedure GetVarList;
begin
   .......
end;
procedure GetIconList;
begin
  .......
end;
procedure GetStationBannerList;
begin
  .....
end;
procedure GetBannerList;
begin
 .......
end;
procedure DownUnZip;
begin
  ......
end;
procedure TDownLoad.Execute;
begin
  { Place thread code here }
  if not Terminated then GetCate2List;
  if not Terminated then GetSearchList;
  if not Terminated then GetStateList;
  if not Terminated then Get911List;
  if not Terminated then GetVarList;
  if not Terminated then GetFrontList;
  if not Terminated then GetIconList;
  if not Terminated then GetStationBannerList;
  if not Terminated then GetBannerList;
  {if not Terminated then Synchronize(GetCate2List);
  if not Terminated then Synchronize(GetSearchList);
  if not Terminated then Synchronize(GetStateList);
  if not Terminated then Synchronize(Get911List);
  if not Terminated then Synchronize(GetVarList);
  if not Terminated then Synchronize(GetFrontList);
  if not Terminated then Synchronize(GetIconList);
  if not Terminated then Synchronize(GetStationBannerList);
  if not Terminated then Synchronize(GetBannerList); }
  //DownLoad...
  if VerCheck then begin
    DownUnZip ;
    end;
end;
end.
프로그램 종료는(버튼 이벤트....)
       try
         showwindow(frmmain.Handle,sw_hide);
         frmmain.SetClear;
         frmMain.AppExit;
        except
         end;
         frmMain.Close;
      end;
AppExit 프로시저......
procedure TfrmMain.AppExit;
begin
 LogUpdate;//로그파일 저장프로시저
 if  Assigned(DownLoad) then  begin
  DownLoad.Terminate;
  DownLoad.WaitFor;
  end;
end;
이렇게 코딩을 했는데 맞는지 안맞는지....
아시는 분 부디 저에게 도움을 좀 주시면 정말 감사하겟습니다....
설명이 될려나 .....
그럼 많은 조언 부탁드립니다