开发者

Problem with Splash Screen in Lazarus app

I am porting a Delphi application to FPC/Lazarus and this application shows info in splash screen. When unit has initialization section then this initialization section calls something like:

Splash.Info(unit_name)

This works in Delphi, but when I compiled this using FPC/Lazarus then I got exception when I create form with splash screen:

Failed to create win32 control, error 1407 : Cannot find window class

I found, that forms can be created after Application.Initialize; was called, so my workaround is to create splash form when 开发者_JS百科ScreenInfo.Initialized=true. It works, but does not show all info. Is there any way to show splash form from unit initialization section, before Application.Initialize;?


Apparantly the FPC/Lazarus implementation of the VCL differs enough from the Delphi VCL to not allow form initialization before the Application object has been initialized.

So the best you can do to make it work in both Delphi and FPC/Lazarus is either

  • Delay the initialization until you are sure that both the Delphi VCL and FPC/Lazarus VCL are ready for it
  • Duplicate your code with conditional defines to generate optimum implementations for both Delphi VCL and FPC/Lazarus VCL

--jeroen


In SplashScreen initialization code that is called for every string I want to show on this splash I finished with:

...
{$IFDEF FPC}
if not ScreenInfo.Initialized then
    exit;
{$ENDIF}
if not splash_inititialized then begin
  SplashScreen := TSplashScreen.Create(Application);
  splash_inititialized := true;
  ...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜