Not a Member Yet,
Click here to Register
How do you like the new design?

ID: 220
Viewed: 3070
Added: Apr 29, 2002
Snippet uploaded by: snippet
Written By: unknown
Demo: Sorry, no demo

User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

Once again I cannot advocate using the Sleep function for anything because there is a possibility that it will cause your app to stop responding here is my example of how to use a splash screen....

Highlight all by clicking in box
Option Explicit
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _
ByVal x As Long, ByVal y As Long, ByVal cx As Long, _
ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1

Private Sub Form_Load()
Dim sngWaitTime As Single

sngWaitTime = 5

'assure the splash form gets displayed

'set the splash screen to stay on top
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE

'wait 5 seconds
Wait sngWaitTime

'splash screen no longer needs to be on top
SetWindowPos Me.hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, 0

'hide and unload the splash screen
Unload Me

'show the main form
Load frmMain

End Sub

Private Sub Wait(sngSecs As Single)
Dim lStrt As Single

lStrt = Timer

Do Until Timer - lStrt >= sngSecs
If Timer < lStrt Then

'this condition just in case timer resets to 0 at 'midnight so that this sub will not get stuck in 'an endless loop
If (86400 + Timer) - lStrt >= sngSecs Then
Exit Do
End If

End If

End Sub

Highlight All

No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.

Replying to a Comment...

Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2017 All Rights Reserved. Conditions