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.
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.
|First, dynamically load and run the splash screen.|
|Then, start loading the main program.|
|After a bit of a wait, bring up the main screen.|
|Last, tidy up the 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.
Next we load this into our Splash Screen VI by Edit >> Import Picture to Clipboard... like this.
The progress indicator is simply a ring control made from a rotated metafile created in LibreOffice.
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.
So now you have no excuse for dull, rectangular LabVIEW!