English 中文(简体)
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 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;?

最佳回答

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;
  ...
问题回答

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





相关问题
determining the character set to use

my delphi 2009 app has a basic translation system that uses GNUGetText. i had used some win API calls to prepare the fonts. i thought it was working correctly until recently when someone from Malta ...

Help with strange Delphi 5 IDE problems

Ok, I m going nuts here. For the last (almost) four years, I ve been putting up with some extremely bad behavior from my Delphi 5 IDE. Problems include: Seemingly random errors in coride50.bpl ...

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How convert string to integer in Oxygene

In Delphi, there is a function StrToInt() that converts a string to an integer value; there is also IntToStr(), which does the reverse. These functions doesn t appear to be part of Oxygene, and I can ...

Quick padding of a string in Delphi

I was trying to speed up a certain routine in an application, and my profiler, AQTime, identified one method in particular as a bottleneck. The method has been with us for years, and is part of a "...

热门标签