Click to See Complete Forum and Search --> : Splash Screen
Crusade Staff
March 21st, 2001, 09:02 PM
I just bought VB 6.0 so beware >:)
I now have made a splash screen, (woohoo) however, it only appears for a fraction of a second! I want it to appear for about 4 sec, what do I do, and where do I do it? lol feel free to make the most detailed explaination possible.
"Evil will always win because Good is dumb"
Iouri
March 21st, 2001, 09:15 PM
Your splash screen is usually is the start up form. There on a form load event you call the desired form and your splash screen is disappearing. In order to see it for 4 sec you have to delay it. You can use eithr timer or insert loop there. for example
Private sub Form1_Load()
dim lIndex as long
for lIndex = 0 to 10000
DoEvents
Next lIndex
Unload Me
Load Form2
Form2.Show
End Sub
If 10000 is not enough time, you can increase it
good luck
Iouri Boutchkine
iouri@hotsheet.com
epelyavski
March 21st, 2001, 09:25 PM
Another way is to use Main procedure and Win API Sleep function. Don't forget to set your Startup Object to 'Sub Main' in your Project Properties (Project->Project1 Properties...)
option Explicit
public Declare Sub Sleep Lib "kernel32" (byval dwMilliseconds as Long)
Sub Main()
Dim Splash as frmSplash
set Splash = new frmSplash
Splash.Show
DoEvents
Sleep 2000
Unload Splash
set Splash = nothing
frmMain.Show
End Sub
Crusade Staff
March 21st, 2001, 10:01 PM
Ahhh... I don't know where to put that :) This is what I tried, and it didn't work lol
http://www.xwlegacy.net/crusade/splash.jpg
"Evil will always win because Good is dumb"
Crusade Staff
March 21st, 2001, 10:07 PM
I found the project properties, but I don't know where to put that code :(
"Evil will always win because Good is dumb"
epelyavski
March 21st, 2001, 10:18 PM
Add a Module to your project and put the code there. You also need frmSplash - form where you put your Splash image,etc.; frmMain - main form of your application;
Crusade Staff
March 21st, 2001, 10:41 PM
When I try to compile it, it tells me there is an error compiling. this is the entire thing I have in the module:
"Public fMainForm As frmMain
Sub Main()
frmSplash.Show
frmSplash.Refresh
Set fMainForm = New frmMain
Load fMainForm
Unload frmSplash
fMainForm.Show
End Sub
Option Explicit
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub Main()
Dim Splash As frmSplash
Set Splash = New frmSplash
Splash.Show
DoEvents
Sleep 2000
Unload Splash
Set Splash = Nothing
frmMain.ShowEnd
End Sub"
Also, right in between the "Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)"
and
"Sub Main()"
it adds a line in.
When it tries to compile it says:
"Compile Error:
Only comments may appear after End Sub, End Function, or End Property"
"Evil will always win because Good is dumb"
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.