You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var (
moduser32 = syscall.NewLazyDLL("user32.dll")
procWaitForInputIdle = moduser32.NewProc("WaitForInputIdle")
proGetWindowModuleFileName = moduser32.NewProc("GetWindowModuleFileNameW")
)
// WaitForInputIdle waits until the specified process has finished processing its initial input and is waiting for user input with no input pending, or until the time-out interval has elapsed.
func WaitForInputIdle(hwnd win.HWND, timeoutMsec int) {
_, _, _ = procWaitForInputIdle.Call(
uintptr(hwnd),
uintptr(timeoutMsec))
}
// GetWindowModuleFileName retrieves the full path and file name of the module associated with the specified window handle.
func GetWindowModuleFileName(hwnd win.HWND) (moduleFileName string) {
bufLen := 1000
buf := make([]uint16, bufLen+1)
textLen, _, _ := proGetWindowModuleFileName.Call(
uintptr(hwnd),
uintptr(unsafe.Pointer(&buf[0])),
uintptr(bufLen))
if textLen > 0 { // processes of other owner do not reveal their info (unless we have elevated privilege)
moduleFileName = syscall.UTF16ToString(buf)
}
return
}
The text was updated successfully, but these errors were encountered:
Could you merge these functions?
The text was updated successfully, but these errors were encountered: