希米日志


主页 归档 留言 友人 关于


27 0

程序代码

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
'----------------------------------------------------根据句柄取进程路径

 2016-11-08 18:29:00

二维码

 评论: 0

正在加载验证码......

请先完成验证

目 录