vb打开程序并隐藏窗口
VB要打开c:\mu.exe程序(这个程序是个按键精灵的小精灵),需要通过打开他并且隐藏窗口。如何做到?要代码,不要思路。好代码我追加200分!...
VB要打开c:\mu.exe程序(这个程序是个按键精灵的小精灵),需要通过打开他并且隐藏窗口。如何做到?要代码,不要思路。
好代码我追加200分! 展开
好代码我追加200分! 展开
3个回答
2013-10-19
展开全部
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
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
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-10-19
展开全部
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
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
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-10-19
展开全部
你说的隐藏是放在托盘里吧
怎么不通过,真有意思。
怎么不通过,真有意思。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询