I am using Peter Below PBThreadedSplashForm to display during application startup. It is updated as various databases open during the creation of the data module (immediately before the creation of the main form).
The problem is that we check for the existence of certain things that are performed during the creation of the data module. If any of these elements is missing, a modal dialog is displayed so that either the element can be created or the application is closed. (Missing elements are usually indexes, and the dialog is used mainly for reindexing databases, so it is aimed at developers and non-regular users.) However, a modal dialog is displayed behind the splash screen; it looks like a focused window as the title changes, but it appears behind the splash screen.
The screensaver is created using the Windows API CreateWindowEx () from a thread other than the main process, using the following code:
procedure TPBSplashThread.CreateSplashWindow;
const
TopmostStyle: Array [Boolean] of DWORD = (0, WS_EX_TOPMOST );
NoActivateStyle : Array [Boolean] of DWORD = (0, WS_EX_NOACTIVATE );
var
wsize: TSize;
begin
wsize.cx := FSurface.Width + GetSystemMetrics( SM_CXEDGE ) * 2;
wsize.cy := FSurface.Height + GetSystemMetrics( SM_CYEDGE ) * 2;
FWnd := CreateWindowEx(
TopmostStyle[ FTopmost ] or WS_EX_TOOLWINDOW
or WS_EX_STATICEDGE or WS_EX_CLIENTEDGE
or NoActivateStyle[ Win32MajorVersion >= 5 ],
MakeIntResource( FWndClass ),
nil,
WS_POPUP or WS_BORDER,
Forigin.x, Forigin.y,
wsize.cx, wsize.cy,
0, 0, hInstance, self );
If FWnd = 0 Then
raise exception.create('TPBSplashThread.CreateSplashWindow: CreateWindowEx failed');
end;
FTopmost - ( ), , - . ( False, , .) SetForegroundWindow() SetWindowPos() OnShow .
- , ?