CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: Splash Screen

  1. #1

    Splash Screen

    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"

  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Splash Screen

    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
    [email protected]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    Mar 2001
    Location
    Canada
    Posts
    13

    Re: Splash Screen

    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





  4. #4

    Re: Splash Screen

    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"

  5. #5

    Re: Splash Screen

    I found the project properties, but I don't know where to put that code

    "Evil will always win because Good is dumb"

  6. #6
    Join Date
    Mar 2001
    Location
    Canada
    Posts
    13

    Re: Splash Screen

    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;


  7. #7

    Re: Splash Screen

    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"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured