我用VB隐藏窗口?

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

Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Function MyHotKey(vKeyCode) As Boolean
MyHotKey = (GetAsyncKeyState(vKeyCode) < 0)
End Function
Private Sub Form_Load()
Timer1.Interval = 80
End Sub
Private Sub Timer1_Timer()
'定义热键
If MyHotKey(vbKeyF4) Then
If Me.Visible = True Then
Me.Visible = False
Else
Me.Visible = True
End If
End If
End Sub

分数有点少了~hookkeyboard可以做到,
或者你注册热键~

其他的么~就不敢保证了