DELPHI (VCL及FMX[Firemonkey])启动时的欢迎窗口实现代码


本文整理自网络,侵删。

 
VCL里面的的实现

program ZhouFamily;
 
uses
  Vcl.Forms,
  Winapi.Windows,
  FrmZhouFamilyMainU in 'FrmZhouFamilyMainU.pas' {FrmZhouFamilyMain} ,
  SplashFormU in 'SplashFormU.pas' {SplashForm} ,
  DmU in 'DmU.pas' {DM: TDataModule};
 
var
  Timestart, timeend: dword;
 
begin
 
  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  SplashForm := TSplashForm.Create(Application);
  SplashForm.Show;
  SplashForm.Update;
  Timestart := gettickcount;
  Application.CreateForm(TDM, DM); // 数据模块加载
  Application.CreateForm(TFrmZhouFamilyMain, FrmZhouFamilyMain); // 主窗口加载
  timeend := gettickcount;
  if timeend - Timestart < 1000 then
  begin
    sleep(1000 - (timeend - Timestart));
  end;
  SplashForm.Hide;
  SplashForm.Free;
  Application.Run;
 
end.
  

 

 

 

FMX里面的实现,很不完美,只是为了闪屏而闪屏,因为form的create 事件是在  Application.Run;后才执行的,如果哪位兄弟有好的改进版本,期待能通知下我!

program ZhouFamily;
 
uses
  FMX.Forms,
  System.SysUtils,
  FrmZhouFamilyMainU in 'FrmZhouFamilyMainU.pas' {FrmZhouFamilyMain} ,
  SplashFormU in 'SplashFormU.pas' {SplashForm} ,
  DmU in 'DmU.pas' {DM: TDataModule};
 
{$R *.res}
 
var
  Timestart, timeend: Tdatetime;
 
begin
  Application.Initialize;
  SplashForm := TSplashForm.Create(nil);
  Timestart := gettime;
  Application.ProcessMessages;
  Application.CreateForm(TDM, DM);
  Application.CreateForm(TFrmZhouFamilyMain, FrmZhouFamilyMain);
  Application.ProcessMessages;
  timeend := gettime;
  if timeend - Timestart < 1000 then
  begin
    sleep(1000 - trunc(timeend - Timestart));
  end;
  SplashForm.Hide;
  SplashForm.Free;
  Application.Run;
 
end.

来源:https://www.cnblogs.com/zhqian/archive/2012/11/20/2778335.html

相关阅读 >>

Delphi 运行时提升软件到管理员权限

Delphi 设置webbrowser 代理服务器 与 useragent

Delphi使用idtcpclient和idtcpserver相互发送数据

Delphi tstream详解

Delphi下获取系统默认的useragent的方法

Delphi 10 seattle的android应用程序的主屏幕上创建快捷方式

Delphi 替换其他程序里面的函数为自己的函数

Delphi动态分配指针长度

Delphi idhttp post 普通提交乱码处理

Delphi 计算运行耗时的方法1

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...