用VB编一段代码,用来打开任务管理器?
答案:2 悬赏:0 手机版
解决时间 2021-02-02 07:42
- 提问者网友:放下
- 2021-02-01 14:41
有时候经常要打开cmd,任务管理器,注册表等,每次都得用运行命令,麻烦得很,所以希望自己用VB编一个程序,用来快捷打开
最佳答案
- 五星知识达人网友:神也偏爱
- 2021-02-01 15:52
这个问题这样可以解决:
1:在公共模块里面首先申明:
Public Const SW_HIDE = 0
Public Const SW_SHOWNORMAL = 1
Public Const SW_SHOWMINIMIZED = 2
Public Const SW_SHOWMAXIMIZED = 3
Public Const SW_MAXIMIZE = 3
Public Const SW_SHOWNOACTIVATE = 4
Public Const SW_SHOW = 5
Public Const SW_MINIMIZE = 6
Public Const SW_SHOWMINNOACTIVE = 7
Public Const SW_SHOWNA = 8
Public Const SW_RESTORE = 9
’ Error Code
Public Const ERROR_FILE_NOT_FOUND = 2
Public Const ERROR_PATH_NOT_FOUND = 3
Public Const ERROR_BAD_FORMAT = 11
Public Const SE_ERR_FNF = 2
Public Const SE_ERR_PNF = 3
Public Const SE_ERR_ACCESSDENIED = 5
Public Const SE_ERR_OOM = 8
Public Const SE_ERR_SHARE = 26
Public Const SE_ERR_ASSOCINCOMPLETE = 27
Public Const SE_ERR_DDETIMEOUT = 28
Public Const SE_ERR_DDEFAIL = 29
Public Const SE_ERR_DDEBUSY = 30
Public Const SE_ERR_NOASSOC = 31
Public Const SE_ERR_DLLNOTFOUND = 32
Public 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
2:在form中按钮点击代码:
Private Sub Command1_Click()
ShellExecute Me.hwnd, open, "taskmgr.exe", vbNullString, vbNullString,
SW_SHOWNORMAL
End Sub
3:主要是ShellExecute这个api函数,网上很多,你可以找找加深影响!
1:在公共模块里面首先申明:
Public Const SW_HIDE = 0
Public Const SW_SHOWNORMAL = 1
Public Const SW_SHOWMINIMIZED = 2
Public Const SW_SHOWMAXIMIZED = 3
Public Const SW_MAXIMIZE = 3
Public Const SW_SHOWNOACTIVATE = 4
Public Const SW_SHOW = 5
Public Const SW_MINIMIZE = 6
Public Const SW_SHOWMINNOACTIVE = 7
Public Const SW_SHOWNA = 8
Public Const SW_RESTORE = 9
’ Error Code
Public Const ERROR_FILE_NOT_FOUND = 2
Public Const ERROR_PATH_NOT_FOUND = 3
Public Const ERROR_BAD_FORMAT = 11
Public Const SE_ERR_FNF = 2
Public Const SE_ERR_PNF = 3
Public Const SE_ERR_ACCESSDENIED = 5
Public Const SE_ERR_OOM = 8
Public Const SE_ERR_SHARE = 26
Public Const SE_ERR_ASSOCINCOMPLETE = 27
Public Const SE_ERR_DDETIMEOUT = 28
Public Const SE_ERR_DDEFAIL = 29
Public Const SE_ERR_DDEBUSY = 30
Public Const SE_ERR_NOASSOC = 31
Public Const SE_ERR_DLLNOTFOUND = 32
Public 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
2:在form中按钮点击代码:
Private Sub Command1_Click()
ShellExecute Me.hwnd, open, "taskmgr.exe", vbNullString, vbNullString,
SW_SHOWNORMAL
End Sub
3:主要是ShellExecute这个api函数,网上很多,你可以找找加深影响!
全部回答
- 1楼网友:怀裏藏嬌
- 2021-02-01 17:26
你好!
毕业后一直没用到时...忘记了
好像要用到API函数,去查下哪个函数然后就是声明调用这些了,就好办了
希望对你有所帮助,望采纳。
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯