根据句柄取进程路径

0 Reply , Posted in 程序代码 on 2016 08, 2016

Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Private Sub Command1_Click()
Dim PID As Long
GetWindowThreadProcessId Text1, PID '根据句柄取得进程ID,text1为句柄

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colProcesses = objWMIService.ExecQuery("SELECT * FROM Win32_Process")
For Each objprocess In colProcesses

If objprocess.processid = PID Then  '当某进程ID与句柄ID相同时
Text2 = objprocess.ExecutablePath   '取得进程路径
End If

Next
End Sub
'----------------------------------------------------根据句柄取进程路径

标签:      

相关推荐

vb读取access并且显示  (2017-5-11 9:18:27)

VB 获取CPU温度示例  (2017-5-8 10:35:11)

VB程序逆向反汇编常见的函数   (2017-5-8 10:32:0)

VB内嵌汇编的模块示例  (2017-5-8 10:24:4)

内存数据的读写(PC)   (2017-3-1 17:51:40)

用VB制作外挂   (2017-3-1 16:16:53)

发表评论:



◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

                       

  鄂公网安备 42112502000156号     鄂ICP备16019550号