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 firedac与ado读写数据的性能测试

Delphi 之 定时器 (ttimer组件)

Delphi删除文件

Delphi如何在tmemo控件光标当前位置插入字符串

Delphi gethomepath - 获取用户程序数据目录

Delphi判断字符是否是汉字

Delphi 根据开始和结束符取得中间字符串

Delphi 获取当天是星期几,计算两个日期相隔时间

Delphi 运行clsid文件

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



打赏

取消

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

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

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

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

评论

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