handledthread.pas

来自「用于CD/DVD烧录的Delphi源码,包括source和demo」· PAS 代码 · 共 51 行

PAS
51
字号
{-----------------------------------------------------------------------------
 Unit Name: HandledThread
 Author:    Paul Fisher / Andrew Semack
 Purpose:   Base class for the Burn and erase threads
 History:
-----------------------------------------------------------------------------}

unit HandledThread;

interface

uses
  Windows, Classes, SysUtils, Forms, Messages;

type
  THandledThread = class(TThread)
  private
    FException: Exception;
    procedure DoHandleException;
  protected
    procedure HandleException; virtual;
  public
  end;

implementation

{ THandledThread }

procedure THandledThread.DoHandleException;
begin
  if GetCapture <> 0 then
    SendMessage(GetCapture, WM_CANCELMODE, 0, 0);
  if FException is Exception then
    Application.ShowException(FException)
  else
    SysUtils.ShowException(FException, nil);
end;

procedure THandledThread.HandleException;
begin
  FException := Exception(ExceptObject);
  try
    if not (FException is EAbort) then
      Synchronize(DoHandleException);
  finally
    FException := nil;
  end;
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?