home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / PVb5.0 / VB / SAMPLES / PGUIDE / OPTIMIZE / SPLSHDMO.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-01-22  |  4.3 KB  |  147 lines

  1. VERSION 5.00
  2. Begin VB.Form frmSplashDemo 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "
  5.    ClientHeight    =   1710
  6.    ClientLeft      =   1515
  7.    ClientTop       =   1470
  8.    ClientWidth     =   5505
  9.    ClipControls    =   0   'False
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    PaletteMode     =   1  'UseZOrder
  14.    ScaleHeight     =   114
  15.    ScaleMode       =   3  'Pixel
  16.    ScaleWidth      =   367
  17.    ShowInTaskbar   =   0   'False
  18.    Begin VB.CommandButton cmdAppStartup 
  19.       Caption         =   "
  20. (&O)"
  21.       Height          =   500
  22.       Index           =   1
  23.       Left            =   3015
  24.       TabIndex        =   1
  25.       Top             =   1080
  26.       Width           =   1350
  27.    End
  28.    Begin VB.CommandButton cmdAppStartup 
  29.       Caption         =   "
  30. (&W)"
  31.       Height          =   500
  32.       Index           =   0
  33.       Left            =   915
  34.       TabIndex        =   0
  35.       Top             =   1080
  36.       Width           =   1350
  37.    End
  38.    Begin VB.Label Label1 
  39.       BorderStyle     =   1  'Fixed Single
  40.       Caption         =   "
  41.       BeginProperty Font 
  42.          Name            =   "
  43.          Size            =   12
  44.          Charset         =   134
  45.          Weight          =   700
  46.          Underline       =   0   'False
  47.          Italic          =   0   'False
  48.          Strikethrough   =   0   'False
  49.       EndProperty
  50.       ForeColor       =   &H00800000&
  51.       Height          =   720
  52.       Left            =   0
  53.       TabIndex        =   2
  54.       Top             =   45
  55.       Width           =   5490
  56.    End
  57. Attribute VB_Name = "frmSplashDemo"
  58. Attribute VB_GlobalNameSpace = False
  59. Attribute VB_Creatable = False
  60. Attribute VB_PredeclaredId = True
  61. Attribute VB_Exposed = False
  62. Option Explicit
  63. Private Sub cmdAppStartup_Click(Index As Integer)
  64.   Dim dStartTime As Double
  65.   dStartTime = Timer
  66.     Select Case Index
  67.       Case 0  '
  68.         ShowSplash
  69.       Case 1  '
  70.         NoSplash
  71.     End Select
  72.     MsgBox "
  73.  = " & Format$(Timer - dStartTime, "##.##") & " 
  74.                                             vbInformation, _
  75.                                             "
  76.   End Sub
  77. Private Sub NoSplash()
  78.             
  79.   Dim foo1 As New frmImages
  80.   foo1.Caption = "Foo1"
  81.   foo1.Left = 0
  82.   foo1.Top = 0
  83.           
  84.   Dim foo2 As New frmImages
  85.   foo2.Caption = "Foo2"
  86.   foo2.Left = 200
  87.   foo2.Top = 100
  88.           
  89.   Dim foo3 As New frmImages
  90.   foo3.Caption = "Foo3"
  91.   foo3.Left = 300
  92.   foo3.Top = 150
  93.           
  94.   Dim foo4 As New frmImages
  95.   foo4.Caption = "Foo4"
  96.   foo4.Left = 400
  97.   foo4.Top = 200
  98. End Sub
  99. Private Sub ShowSplash()
  100.   Dim success%
  101.   Dim iStatusBarWidth As Integer
  102.   On Error GoTo SplashLoadErr
  103.   iStatusBarWidth = 4575
  104.             
  105.   Screen.MousePointer = vbHourglass
  106.   Load Splash
  107.   Splash.Show
  108.   DoEvents
  109.   success% = SetWindowPos(Splash.hWnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)
  110.   Dim foo1 As New frmImages
  111.   foo1.Caption = "Foo1"
  112.   foo1.Move 0, 0
  113.   DoEvents
  114.   Splash.rctStatusBar.Width = iStatusBarWidth * 0.25
  115.           
  116.   Dim foo2 As New frmImages
  117.   foo2.Caption = "Foo2"
  118.   foo2.Move 0, 0
  119.   DoEvents
  120.   Splash.rctStatusBar.Width = iStatusBarWidth * 0.5
  121.   Dim foo3 As New frmImages
  122.   foo3.Caption = "Foo3"
  123.   foo3.Move 0, 0
  124.   DoEvents
  125.   Splash.rctStatusBar.Width = iStatusBarWidth * 0.75
  126.           
  127.   Dim foo4 As New frmImages
  128.   foo4.Caption = "Foo4"
  129.   foo4.Move 0, 0
  130.   DoEvents
  131.   Splash.rctStatusBar.Width = iStatusBarWidth
  132.   success% = SetWindowPos(Splash.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS)
  133.   Unload Splash
  134.   Screen.MousePointer = vbDefault
  135.   Exit Sub
  136. SplashLoadErr:
  137.   success% = SetWindowPos(Splash.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS)
  138.   Unload Splash
  139.   Screen.MousePointer = vbDefault
  140.   MsgBox Error$ & " - " & Str$(Err), vbExclamation, "
  141.   Exit Sub
  142. End Sub
  143. Private Sub Form_Load()
  144.   Me.Left = frmExplore.Width + 400
  145.   Me.Top = (Screen.Height - Me.Height) * 0.9
  146. End Sub
  147.