⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 startplaythread.pas

📁 局域网VCD影院 用DELPHI 编写的 局域网VCD影院
💻 PAS
字号:
unit StartPlayThread;

interface

uses
  Windows, Classes, Forms, Unit_FrmVideo, Mpeg1DecodeDll, MyDef;

type
  TStartPlayThread = class(TThread)
  private
    iSeek: integer;
    { Private declarations }
  protected
    procedure Execute; override;
  private
    BStart: Boolean;
  public
    constructor Create(const Seek: integer; const Suspend, Start: Boolean);
    constructor Terminate; //强行结束
    destructor Destroy; override; //正常结束
  end;

implementation
uses
  Unit_FrmMain, SendMsgSock;
{ Important: Methods and properties of objects in VCL can only be used in a
  method called using Synchronize, for example,

      Synchronize(UpdateCaption);

  and UpdateCaption could look like,

    procedure TStartPlayThread.UpdateCaption;
    begin
      Form1.Caption := 'Updated in a thread';
    end; }

{ TStartPlayThread }

constructor TStartPlayThread.Create(const Seek: integer; const Suspend, Start: Boolean);
begin
  iSeek := Seek;
  BStart := Start;
  inherited Create(Suspend);
end;

constructor TStartPlayThread.Terminate; //强行结束
begin
//Place  code here
  inherited Terminate;
end;

destructor TStartPlayThread.Destroy; //正常结束
begin
//Place  code here
  inherited Destroy;
end;

procedure TStartPlayThread.Execute;
var
  DisPlayHandle: THandle;
  DisPlayRect: TRect;
begin
  if FrmVideo.WindowState = wsNormal then
  begin
    DisPlayHandle := FrmVideo.Panel1.Handle;
    DisPlayRect := FrmVideo.Panel1.ClientRect;
  end;
  if FrmVideo.WindowState = wsMaximized then
  begin
    DisPlayHandle := FrmVideo.Handle;
    DisPlayRect := FrmVideo.ClientRect;
  end;
//FrmVideo.WindowScreen.Click;
  if Mpeg1Decode_OpenVideo(DisPlayHandle, DisPlayRect, iSeek) then
  begin
    FrmMain.btFile.Enabled := False;
    FrmMain.btVcd.Enabled := FrmMain.btFile.Enabled;
    FrmMain.Mousebar1.Enabled := True;
    FrmMain.Timer1.Enabled := True;
//if BStart  then //FrmMain.UdpBroadSender.BroadStr(ResultPState)
//           else //FrmMain.UdpBroadSender.BroadStr(ResultRefresh);
  end
  else
  begin
    SendMsg_Stop(FrmMain.iMulticastGroup);
//FrmMain.UdpBroadSender.BroadStr(ResultTState);
    FrmMain.btStop.Click;
  end;
  Terminate;
  { Place thread code here }
end;

end.

⌨️ 快捷键说明

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