Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Load Splash Screen

Posted on 2000-02-21
7
Medium Priority
?
280 Views
Last Modified: 2010-05-02
What code do I use to make my splash screen functional.  ie. make it visible until the rest of the application is loaded and ready to go then hide it.  This is probably simple but I'm not sure how to do it.  Any help would be appreciated.

0
Comment
Question by:jakemail
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 3

Expert Comment

by:SirNick
ID: 2543664
I have always done this by using a timer and show the splash screen on form_load() plus enabling the timer to about 2 seconds.  
When the timer is triggered it with hide the splash screen

The code I use goes something like this.

-----------------------------------
private sub form_load()
  Splash1.show
  Timer1.enabled = true
end sub

-----------------------------------

private sub timer1_()
  splash1.hide
  timer1.enabled = false
end sub

---------------------------------

I am not sure whether this is the right way but it works.

Hope this helps.
0
 
LVL 32

Expert Comment

by:Erick37
ID: 2543694
This will display a splash screen for as long as it takes to load frmMain.  Add a delay if you want to show the screen longer.

'~~~~Splash Code~~~~

Private Sub Form_Load()
    Show
    Refresh
    Load frmMain
    Hide
    frmMain.Show
    Unload Me
End Sub
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2543723
Splash Form:

Private Sub Form_Load()
Timer1.Interval = 1000
End Sub

Private Sub Timer1_Timer()
Static timertime As Integer
timertime = timertime + 1
If timertime = 5 Then
Form2.Show
Unload Me
Set Form1 = Nothing
End If
End Sub

Form2:
Private Sub Form_Load()
Form1.Hide
End Sub
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 6

Accepted Solution

by:
anthonyc earned 150 total points
ID: 2543926
All three of those solutions are ugly.  Why do I need a timer to show a splash screen?  

The 2nd solution is a little better, however, it doesn't lead itself to a generic splashscreen object.

Use a SUB MAIN.  

Public Sub Main
  Load frmSplash
  with frmSplash
    .AppTitle = app.title
    .SubTitle = "blah blah blah"
    .Show
  end with

  'Do all initialization work here
 
  'notice, LOAD, without show.  
  load frmMain

  unload frmSplash
  set frmSplash = nothing
  doevents
  frmMain.show
end sub
0
 
LVL 3

Expert Comment

by:3rsrichard
ID: 2543943
The MS recommendation is

Private Sub Main()
   ' Show the splash screen.  
   frmSplash.Show
   ' Add your startup procedures here.
   …
   ' Show the main form and unload the splash screen.
   frmMain.Show
   Unload frmSplash
End Sub

0
 
LVL 6

Expert Comment

by:anthonyc
ID: 2543960
MS solution is good, but sometimes you'll have both the splash and the main up.  Even if for a short time.  They can collide with one another on slower machines and give a graphics flicker.
0
 
LVL 15

Expert Comment

by:ameba
ID: 2544413
I found this is the best way (smooth, user friendly multitasking):

Public Sub Main()
    frmSplash.Show
    DoEvents
    Load frmMain ' open db, ...
    DoEvents
    If GetActiveWindow = frmSplash.hWnd Then
        SetWindowPos frmSplash.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOSIZE Or SWP_NOMOVE
        frmMain.Show
        SetWindowPos frmSplash.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOSIZE Or SWP_NOMOVE
    Else
        SetWindowPos frmMain.hWnd, frmSplash.hWnd, 0, 0, 0, 0, SWP_SHOWWINDOW Or SWP_NOSIZE Or SWP_NOMOVE
    End If
    DoEvents
    If Len(Command) Then
       ' do something
    End If
    Unload frmSplash
    Set frmSplash = Nothing
End Sub
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question