最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
开发手记(七)――实现图标首窗体的启动滞留
时间:2022-07-02 12:08:37 编辑:袖梨 来源:一聚教程网
大部分软件的主窗体启动之前,都有一个图标首窗体的启动,并且图标窗体与主窗体共存一段时间,您可以打开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
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
相关文章
- 《无限暖暖》天星之羽获得位置介绍 12-20
- 《流放之路2》重铸台解锁方法介绍 12-20
- 《无限暖暖》瞄准那个亮亮的成就怎么做 12-20
- 《无限暖暖》魔气怪终结者完成方法 12-20
- 《无限暖暖》曙光毛团获得位置介绍 12-20
- 《无限暖暖》日光果获得位置介绍 12-20