mirror of
https://github.com/go-vgo/robotgo
synced 2026-05-24 02:08:33 +00:00
add process FindPath() function
This commit is contained in:
parent
d768b5e315
commit
0d402e0432
1 changed files with 15 additions and 0 deletions
15
robotgo.go
15
robotgo.go
|
|
@ -1714,6 +1714,21 @@ func FindIds(name string) ([]int32, error) {
|
|||
return pids, err
|
||||
}
|
||||
|
||||
// FindPath find the process path by the process pid
|
||||
func FindPath(pid int32) (string, error) {
|
||||
nps, err := process.NewProcess(pid)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
f, err := nps.Exe()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return f, err
|
||||
}
|
||||
|
||||
func internalActive(pid int32, hwnd int) {
|
||||
C.active_PID(C.uintptr(pid), C.uintptr(hwnd))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue