rodrigocfd / windigo

Windows API and GUI in idiomatic Go.
https://pkg.go.dev/github.com/rodrigocfd/windigo
MIT License
417 stars 23 forks source link

GetWindowThreadProcessId() Can't get process id due to remove second param #6

Closed rogeecn closed 2 years ago

rogeecn commented 2 years ago

in this function

func (hWnd HWND) GetWindowThreadProcessId() uint32 {
    ret, _, _ := syscall.Syscall(proc.GetWindowThreadProcessId.Addr(), 2,
        uintptr(hWnd), 0, 0)
    return uint32(ret)
}

after changed to

func (hWnd HWND) GetWindowThreadProcessId() (uint32,uint32) {
    var processId uint32
    ret, _, _ := syscall.Syscall(proc.GetWindowThreadProcessId.Addr(), 2,
        uintptr(hWnd), uintptr(unsafe.Pointer(&processId)), 0)
    return uint32(ret), processId
}

i got the right processID

rodrigocfd commented 2 years ago

You are correct. This function returns both the thread and process IDs. I misread the documentation.