请陈辉大哥指导一下这三个函数的应用
Private Declare Function CreateJobObject Lib "kernel32.dll" Alias "CreateJobObjectA" (ByRef lpJobAttributes As Any, ByVal lpName As String) As Long
Private Declare Function AssignProcessToJobObject Lib "kernel32.dll" (ByVal hJob As Long, ByVal hProcess As Long) As Long
Private Declare Function TerminateJobObject Lib "kernel32.dll" (ByVal hJob As Long, ByVal uExitCode As Long) As Long
Private Declare Function CreateJobObject Lib "kernel32.dll" Alias "CreateJobObjectA" (ByRef lpJobAttributes As Any, ByVal lpName As String) As Long
Private Declare Function AssignProcessToJobObject Lib "kernel32.dll" (ByVal hJob As Long, ByVal hProcess As Long) As Long
Private Declare Function TerminateJobObject Lib "kernel32.dll" (ByVal hJob As Long, ByVal uExitCode As Long) As Long
解决方案 »
- vb webbrowser 如何访问框架里的菜单链接
- 帮忙看看这个读取注册表的代码有什么不对的?!
- 请问如何做MDI窗口的“窗口”菜单??
- 提问关于下载字符?高手快来啊!!
- 初学VB,请多指教--声明变量的格式为:Dim hw& 是什么意思??
- 我想将 报表控件 中的每一个CELL变成下拉列表的形式,请问用哪个控件可以实现?
- 关于datagrid的打印问题
- 如何在TCP数据流中判断经纬度信息的起始位置? 比如一个包中有很多条数据,只知道每条数据的第14-17 四个字节代表纬度但包中数据不定长
- “多步操作产生错误。请检查每一步的状态值。”
- 在VB上如何制作操作日志?
- 如何实现发票结存量的特殊统计
- 100分求一控件实例.
Private Declare Function AssignProcessToJobObject Lib "kernel32.dll" (ByVal hJob As Long, ByVal hProcess As Long) As Long
Private Declare Function TerminateJobObject Lib "kernel32.dll" (ByVal hJob As Long, ByVal uExitCode As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Const SYNCHRONIZE = &H100000Private Const STANDARD_RIGHTS_REQUIRED = &HF0000Const PROCESS_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &HFFF
Public Function MyTerminateProcess(ByVal hpid As Long) As Boolean
Dim hJob As Long
Dim hProcess As Long
Dim tmp
MyTerminateProcess = False
hJob = CreateJobObject(ByVal 0&, "") If hJob Then
hProcess = OpenProcess(PROCESS_ALL_ACCESS, False, hpid)
tmp = AssignProcessToJobObject(hJob, hProcess) tmp = TerminateJobObject(hJob, 0)
MyTerminateProcess = True
End If
End FunctionPrivate Sub Form_Load()
MyTerminateProcess 976
End Sub