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

📄 mainscreen.pas

📁 flash相关的开发应用。
💻 PAS
字号:
unit MainScreen;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, OleCtrls, ShockwaveFlashObjects_TLB, ExtCtrls, DDEasy, AppEvnts;

type
  TForm1 = class(TForm)
    Image: TImage;
    Flash: TShockwaveFlash;
    DDEasy1: TDDEasy;
    ApplicationEvents1: TApplicationEvents;
    Image1: TImage;
    procedure ApplicationEvents1Message(var Msg: tagMSG;
      var Handled: Boolean);
    procedure FormPaint(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
    ExitKey : Word;
    FFilename    : string;
    DisplayTime2 : integer;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
  var Handled: Boolean);
var Aktualtime : integer;
begin
  if msg.message = WM_KEYUP
    then if msg.wParam = ExitKey
           then Begin
             Flash.Stop;
             DDEasy1.Ende;
             DeleteFile(FFilename);
             Form1.Left := (Screen.Width  - Image1.Picture.Bitmap.Width)  DIV 2;
             Form1.Top  := (Screen.Height - Image1.Picture.Bitmap.Height) DIV 2;
             Form1.Width := Image1.Picture.Bitmap.Width;
             Form1.Height := Image1.Picture.Bitmap.Height;
             Flash.Visible := false;
             image1.Visible := true;
             image1.Repaint;
             application.ProcessMessages;
             AktualTime := DateTimeToTimeStamp(now).Time;
             repeat
               sleep(1);
               application.ProcessMessages;
             until DateTimeToTimeStamp(now).Time - AktualTime >= DisplayTime2;
             application.Terminate;
           end;
end;

procedure TForm1.FormPaint(Sender: TObject);
var InpFile      : TFileStream;
    FlashFile    : TFileStream;
    DataStart    : integer;
    DisplayTime  : integer;
    AktualTime   : integer;
    TargetWidth  : integer;
    TargetHeight : integer;
    TargetBits   : integer;
    rr           : integer;
    Buffer       : array[0..4095] of byte;
begin
  if Form1.Tag = 0
    then Begin
      Form1.Tag := 1;
      Inpfile := TFileStream.Create(ParamStr(0),fmOpenRead or fmShareDenyNone);
      InpFile.Seek(-4,soFromEnd);
      Inpfile.Read(DataStart,4);
      InpFile.Seek(DataStart,soFromBeginning);
      Image.Picture.Bitmap.LoadFromStream(inpfile);
      Image1.Picture.Bitmap.LoadFromStream(inpfile);
      Form1.Left := (Screen.Width  - Image.Picture.Bitmap.Width)  DIV 2;
      Form1.Top  := (Screen.Height - Image.Picture.Bitmap.Height) DIV 2;
      Form1.Width := Image.Picture.Bitmap.Width;
      Form1.Height := Image.Picture.Bitmap.Height;
      image.Repaint;
      InpFile.Read(DisplayTime,4);
      InpFile.Read(DisplayTime2,4);
      AktualTime := DateTimeToTimeStamp(now).Time;
      repeat
        sleep(1);
        application.ProcessMessages;
      until DateTimeToTimeStamp(now).Time - AktualTime >= DisplayTime;
      Image.Visible := false;
      Inpfile.Read(TargetWidth,4);
      Inpfile.Read(TargetHeight,4);
      Inpfile.Read(TargetBits,4);
      Inpfile.Read(ExitKey,2);
      Form1.SetBounds(0,0,TargetWidth,TargetHeight);
      Flash.Visible := true;
      FFilename := ExtractFilePath(ParamStr(0)) + IntToStr(DateTimeToTimeStamp(now).Time) + '.swf';
      FlashFile := TFileStream.Create(FFilename,fmCreate or fmShareDenyNone);
      repeat
        rr := Inpfile.Read(Buffer,4096);
        if (rr <> 4096) or (InpFile.Position = InpFile.Size)
          then rr := rr - 4;
        FlashFile.Write(Buffer,rr);
      until rr <> 4096;
      FlashFile.Free;
      InpFile.Free;
      DDEasy1.Start(Form1.Handle,TargetWidth,TargetHeight,TargetBits);
      Flash.Align := alClient;
      Flash.LoadMovie(0,FFilename);
      Flash.SetFocus;
    end;
end;

end.

⌨️ 快捷键说明

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