大部分软件的主窗体启动之前,都有一个图标首窗体的启动,并且图标窗体与主窗体共存一段时间,您可以打开EXCEL亲身感受一下。
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
Const HWND_TOPMOST = -1 '窗口置顶
Const SWP_SHOWWINDOW = &H40 '显示窗体
Const SWP_NOSIZE = &H1 '不允许改变大小
Private Sub Form_Load()
'设置窗体永远置顶
SetWindowPos Me.hwnd, HWND_TOPMOST, Me.Top, Me.Left, Me.Width, Me.Height, SWP_NOSIZE Or SWP_SHOWWINDOW
End Sub
'Time1 and Time2 配合达到延时效果
Private Sub Timer1_Timer()
Timer2.Enabled = True
MDIForm1.Show
End Sub
Private Sub Timer2_Timer()
Unload Me
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Unload Me
MDIForm1.Show
End Sub
Private Sub Image1_Click()
Unload Me
MDIForm1.Show
End Sub