App loading splash screen

Is there any way to signalize to user that app is loading? I have problem on slower systems, my app is big but main problem is with InMemory driver. When using InMemory driver app is also loading some databases for caching at startup. It takes only few seconds but users usually repeatedly clicking on icon in meantime and then errors pops up. I can’t find right embed point where to call “please wait screen”. In main procedure is already to late and i’m unable to show screen calling it anywhere from global embeds. Any ideas?

What I’ve done in the past was to:

  1. Change my main .EXE to a DLL that only exports the MAIN procedure.
  2. Create a tiny .EXE with a splash window.
  3. After the splash window opens, use LoadLibrary to load the main DLL and start the MAIN procedure.
  4. On the MAIN procedure, I added a WINDOW parameter to pass the splash window from the tiny EXE.
  5. In the MAIN procedure, I’d close the passed splash window.

Worked pretty well.

Thanks, i’ll try that. Thinking that InMemory driver should have some progress window indicating that data is loading.

One quick thing to try would be to place the code that starts the Splash window in the Global Embed “After PROGRAM Code Statement” so the Splash starts ASAP.

An alternative to the Main as DLL that’s a bit less disruptive to your project is to make the splash its own EXE:

  1. Rename Target Main.SLN to build MainSlow.EXE
  2. Create a tiny Main.EXE with just a splash window.
  3. In Splash OpenWindow Run(‘MainSlow.EXE SplashWnd=’ & SplashWindow{PROP:Handle} )

As a failsafe I would put a Timer(2000) on Splash so it closed itself in 20 seconds. The Frame should open over it so it is hidden until it closes.

If you like the way that works move on to solve the problem of MainSlow.exe closing the Splash window when it becomes visible… I’d try sending it a message.

SW=Command('SplashWnd')
IF SW and IsWindow(SW) THEN 
    PostMessage(SW, Event:CloseWindow + 0A000h, 0, 0)
END

The Clarion events are Windows message that are + A000h. If that does not work then I would Post a WM_User+123 and in the Splash Window have to Subclass the window to get WM_. If I did that I would also look for the Query Shutdown and close. I wouldn’t post WM_Close just incase the handle got reused by another window then I would not close it. If that doesn’t work well there are other ways for processes to signal like maybe a Kernel Event.

I don’t think this extra EXE starting would slow down your startup much. I like that it would let you ignore the start up splash trick because in the IDE you would still work on and run MainSlow.,EXE.

For that to make the Splash show instantly you have to code:
SplashThrd=START(SplashProc)
RESUME(SplashThrd)

Else the new thread waits for an ACCEPT which will not happen until your Frame. You probably want that thread number anyway so in the frame you can POST(Event:CloseWindow,SpashThrd) to close it.

1 Like