//------------------------------------------------------------------------- // Copyright (c) 1999 - Sortland Automasjon <automasjon@sortland.net> // // All Rights Reserved // // web: http://www.sortland.net fax: +47 5342 0281 // // Download project: /Delphi/Snippets/SplashScreen.zip // // Loads LOGO from a resource file containing a GIF image (small size !) //-------------------------------------------------------------------------unit Splash; // SplashScreen with or without delay {$DEFINE USE_SPLASH_DELAY} interface uses Windows, Messages, SysUtils, Classes, ExtCtrls, Graphics, Controls, Forms, // You need support for GIF images in this example RxGIF; // RxLib http://rx.demo.ru // GIFimage; // TGIFImage http://www.melander.dk/delphi/gifimage/ type TSplashScreen = class(TForm) ImageLogo: TImage; PanelLogo: TPanel; // Color: $00C8D0D8 PanelText: TPanel; Timer1: TTimer; procedure FormCreate(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure Timer1Timer(Sender: TObject); private { Private declarations } public { Public declarations } end; var SplashScreen: TSplashScreen; implementation {$R *.DFM} {$R SortlandLogo.RES} //--------------------------------------------------------------------------- // Load LOGO from EXE Resource, and display it. //--------------------------------------------------------------------------- procedure TSplashScreen.FormCreate(Sender: TObject); var ResStrm: TResourceStream; GIF: TGIFImage; begin ResStrm := TResourceStream.Create(HInstance, 'SORTLAND_LOGO_GIF', 'GIF'); try GIF := TGIFImage.Create; try GIF.LoadFromStream(ResStrm); // Load the GIF from the resource stream ImageLogo.Picture.Assign(GIF); // Display the GIF in the TImage finally GIF.Free; end; finally ResStrm.Free; end; {$IFDEF USE_SPLASH_DELAY} Timer1.Enabled := True; {$ENDIF USE_SPLASH_DELAY} end; procedure TSplashScreen.Timer1Timer(Sender: TObject); begin Timer1.Enabled := False; // Stop timer end; procedure TSplashScreen.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin {$IFDEF USE_SPLASH_DELAY} CanClose := not Timer1.Enabled; // Delay timeout ? {$ELSE} CanClose := True; // NO Delay {$ENDIF USE_SPLASH_DELAY} end; end.