Sick of Rectangles? Make Your Splash Screen More Interesting

Monday, February 17, 2014

This guest post was written by LabVIEW Champion Steve Watts.

 

For a splash screen to become GROOVY it needs to have a strange shape, exhibit the right kind of transparency, fade in, and have some nice custom progress stuff going on.

 

Interested? Here's how to do it. Code is posted here-- download SplashScreen.zip.

Tools

The LabVIEW bit

You will need to dynamically load the splash screen and then some time after the main program. For a nice fast startup, we want to load the main program in the background and then show the front panel.

 

Startup VI

 

DynLoadSplashscreen.pngFirst, dynamically load and run the splash screen.
DynLoadMainscreen.pngThen, start loading the main program.
BringUpMainscreen.pngAfter a bit of a wait, bring up the main screen.
CleanUpSplashscreen.pngLast, tidy up the splash screen.

 

Splash Screen

This is the pretty bit. First, let's get the graphics. Cut and paste the image into Paint.net and use the magic wand tool.

 

This selects a block of color that you can delete (make transparent). Delete anything else that you are going to replace. In this case, I deleted the progress, version, and link to the website.

MagicWandTool.png

Next we load this into our Splash Screen VI by Edit >> Import Picture to Clipboard... like this.

Splashscreen vi.png

 

The progress indicator is simply a ring control made from a rotated metafile created in LibreOffice.

 

ProgressImpress.pngProgress.png

 

Green Screen Transparency

 

Now the clever bit is that we do not use the property FP.Transparency for this, as it's mostly for fading in and out. We're after a green-screen effect where the background colour is masked. For this we need to use some Windows functions.

 

User32.dll>>FindWindowA - Gets the window handle.

User32.dll>>GetWindowLongA - Retrieves information about the specified window. The function also retrieves the 32-bit (DWORD) value at the specified offset into the extra window memory. We're after extended windows styles.

User32.dll>>SetWindowLongA - Changes an attribute of the specified window. The function also sets the 32-bit (long) value at the specified offset into the extra window memory. The window is a layered window.

User32.dll>>SetLayeredWindowAttributes - Sets the opacity and transparency color key of a layered window.

 

ooohPretty.png

 

So now you have no excuse for dull, rectangular LabVIEW!