Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" _
(ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
' nShowCmd
Const SW_HIDE = 0
'Const SW_SHOWNORMAL = 1
'Const SW_SHOWMINIMIZED = 2
'Const SW_SHOWMAXIMIZED = 3
'Const SW_MAXIMIZE = 3
'Const SW_SHOWNOACTIVATE = 4
'Const SW_SHOW = 5
'Const SW_MINIMIZE = 6
'Const SW_SHOWMINNOACTIVE = 7
'Const SW_SHOWNA = 8
'Const SW_RESTORE = 9
' Error Code
'Const ERROR_FILE_NOT_FOUND = 2
'Const ERROR_PATH_NOT_FOUND = 3
'Const ERROR_BAD_FORMAT = 11
'Const SE_ERR_FNF = 2
'Const SE_ERR_PNF = 3
'Const SE_ERR_ACCESSDENIED = 5
'Const SE_ERR_OOM = 8
'Const SE_ERR_SHARE = 26
'Const SE_ERR_ASSOCINCOMPLETE = 27
'Const SE_ERR_DDETIMEOUT = 28
'Const SE_ERR_DDEFAIL = 29
'Const SE_ERR_DDEBUSY = 30
'Const SE_ERR_NOASSOC = 31
'Const SE_ERR_DLLNOTFOUND = 32
Sub Main()
Dim a As Integer
a = ShellExecute(vbNullString, "open", "NOTEPAD.EXE", vbNullString, vbNullString, SW_HIDE)
End Sub
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
你说的隐藏是放在托盘里吧
怎么不通过,真有意思。