How to Create an Application Splash Screen

Last reviewed: August 9, 1995
Article ID: Q126938
The information in this article applies to:
  • Microsoft FoxPro for Windows, versions 2.6 and 2.6a

SUMMARY

There are several ways in which you can create and use a splash screen in an application. This article outlines two possible methods.

MORE INFORMATION

Method One

  1. Using the Screen Builder, create a new screen. Under the menu option Screen, Layout, Window Style, make the window style type "Desktop". The logo or graphic you want to display can be stored in a General field of one of your system tables. If you want to display a bitmap logo, place a picture field on the screen and size it accordingly, or type the text you want to display on the screen as you ordinarily would.

  2. Include the command #NOREAD as the first statement of your setup code. This will generate the screen but it will not be stopped by FoxPro issuing a READ command. Consequently, any fields you display on the screen will be displayed and program execution will continue.

  3. Include the command at some point in your code, possibly in the menu Setup code:

    DO SPLASH.SPR

If in the future you want to clear off the splash screen, issue this command:

   MODIFY WINDOW SCREEN COLOR <Color_Set>
   CLEAR

While this is an excellent way to put up a splash screen, it does consume memory resources and it may be difficult to size and scale the screen appropriately, especially when you want your logo to take up the full desktop.

As an alternative to the #NOREAD clause in the SETUP code, you could modify the READ clause to this:

   #READCLAUSES TIMEOUT <expN1>

This displays the splash screen for a specific length of time and leaves the RELEASE WINDOWS clause checked in the GENERATE SCREEN dialog. The <expN1> clause is a numeric value that represents seconds.

NOTE: When using this method, you must place the following command in your SETUP code:

   SET CURSOR OFF

This disables the cursor on the screen. To turn it back on, place the following command in the CLEANUP code of the screen:

   SET CURSOR ON

Method Two

The second method is much simpler. However, there are some fine points that you'll need to keep in mind. Generally, this method would most likely work best with a text-based bitmap on a solid background.

  1. Place the following commands in your code:

    ACTIVATE SCREEN @ 0,0 SAY "mylogo.bmp" BITMAP ISOMETRIC

  2. Issue the following command to clear the screen:

    MODIFY WINDOW SCREEN

The following are the fine points you need to keep in mind when using this method:

  1. If you do not want this command to be "path-specific" (that is, @ 0,0 SAY "C:\MYDIR\MYLOGO.BMP"), add the .BMP file to your project as a read-only object, or add the file into the project, mark it as excluded, and distribute it as a stand-alone file with your distributed .EXE file. Note, however, that a user could easily replace this .BMP file with an identically-named .BMP file and thus alter your application.

  2. There are some major differences between using the ISOMETRIC versus using the STRETCH clause on the @ SAY command. The Help file explains this as follows:

    ISOMETRIC | STRETCH

    If the area specified with the SIZE clause is too small to contain a picture or OLE object, the picture is clipped to fit in the area. You can prevent a picture or OLE object from being clipped by including ISOMETRIC or STRETCH. If ISOMETRIC is included, the picture or object is scaled so that its proportions are maintained. The picture is shrunk or expanded to fit within the specified area and isn't distorted. If STRETCH is included, the picture or object is scaled horizontally, vertically or in both directions to fit the picture or object within the area specified by the SIZE clause. The picture or object's proportions are not maintained.

    How this will impact your application is that FoxPro will display the bitmap as you have requested, but if your screen or desktop is not sized accordingly, you may end up with a border around the bitmap. If it is acceptable and your picture looks okay when sized to fit, use the STRETCH parameter; otherwise use the ISOMETRIC parameter.

  3. The name of the BMP file must be enclosed in quotation marks or the @ SAY will fail.

  4. If you use this method on a Macintosh, FoxPro has an order of precedence in how it will search for the file referenced in the @ SAY:

    If you omit the extension for the picture file, FoxPro for Macintosh first looks for a picture file with the name you specified and a .BMP extension. If a picture file with a .BMP extension and the name you specified isn't found, FoxPro for Macintosh then looks for a file with the name you specified and a .PCT extension. If a picture file with a .PCT extension and the name you specified isn't found, FoxPro for Macintosh then looks for a picture file with the name you specified without an extension.


Additional reference words: FoxWin 2.60 2.60a SPLASH SCREEN
KBCategory: kbprg
KBSubcategory: FxprgGeneral


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: August 9, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.