VB隐藏F4窗口

来源:百度知道 编辑:UC知道 时间:2024/06/07 19:24:43
我用VB生成exe后,怎么才能按F4隐藏窗口再次按F4就能显示窗口呢?

Option Explicit
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer

Private Sub Form_Load()

Timer1.Interval = 50
Timer1.Enabled = True

End Sub

Private Sub Timer1_Timer()

Timer1.Interval = 50

If GetAsyncKeyState(vbKeyF4) Then
Form1.Visible = Not Form1.Visible
Timer1.Interval = 1000
End If

End Sub

'不好意思,第一次给写错了~